Feeds

Microsoft measures up

A meter is a meter is a meter. Not

Designing a Defense for Mobile Applications

Project Watch: Microsoft 2008 The next task in rolling out our 1TB SQL Server 2008 application using Visual Studio 2008 and Windows Server 2008 is to import signed spatial data into the spatial data type. This is the code:


UPDATE
        tblSpatialData
SET
        SpatialLocation = 
                geography::STGeomFromText('POINT (' + 
                        CONVERT(nvarchar, Latitude) +
                        ' ' +
                        CONVERT(nvarchar, Longitude) +
                        ')', 4326)
WHERE
        Latitude IS NOT NULL
AND Longitude IS NOT NULL

So what's it doing? We do the conversion via an intermediate - the Well-Known Text (WKT) representation of spatial data as defined by the Open Geospatial Consortium (OGC). As the Text bit suggests, this is a text string. I'm also sure that, while it is undoubtedly Well Known within the OGC, I won't be bringing it up as a topic of conversation in my local pub.

So, we have to convert the signed integers, held in a field called SpatialLocation, into a well-formed WKT string. This is what the following does:


 ('POINT (' + CONVERT(nvarchar, Latitude) + ' ' + CONVERT(nvarchar, Longitude) +')', 4326)

It turns two innocent integers into a WKT string of the form:

POINT (23.2343 34.4544)

WKT as a format is perfectly capable of dealing with more complex structures such as polygons. And the "4326" at the end of the conversion? The 4326 makes it quite clear that we are using good old WGS 84. Those with an interest in the alternatives need only run:


SELECT * FROM sys.spatial_reference_systems

From this, 388 rows of alternatives are returned.

project watch alternatives

Alternative options

To choose one at random, 4604 is the Montserrat 1958 standard. Most of them are based on the meter, but five are based on Clarke's foot (0.304797265 of a meter), one on the Indian foot (0.304799518m) and one on the German legal meter which very, very close to, but annoyingly not exactly the same as, the common or garden meter (1.000013597m).

All of this is, I assume, meat and drink to a geographer, but it is all new territory to a humble database person like myself. It is also an eye opener. Never again will I be defensive about my profession being nerdy.

Boost IT visibility and business value

More from The Register

next story
LibreSSL crypto library leaps from OpenBSD to Linux, OS X, more
First cross-platform version of cleaned-up OpenSSL fork
Think Google Glass is creepy? Wait until it READS YOUR MIND
Startup penetrates the mind of Glassholes
Bezos house 'on FIRE': Amazon in-app kiddy megabuck charge storm
FTC prepares boot for firm's ass in lawsuit
I've got 99 problems, but a Facebook boycott ain't one
If you're havin' Zuck problems, I feel bad for you son
Microsoft wants to lure biz users with fondleable Windows 8.1 'Apportals'
Custom Start Screens lump enterprise apps and data in one place
Victim of Tor-hidden revenge smut site sues Tor Project developers
But EFF lawyer says deep-web team 'no more liable' than web server makers
Chrome Remote Desktop adds Linux to supported OS list
Drive Debian from the confines of a Chromebook
Google's lounge room invasion advances with Chromecast upgrade
Your tellie is about to mirror your Android
prev story

Whitepapers

Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
The Essential Guide to IT Transformation
ServiceNow discusses three IT transformations that can help CIO's automate IT services to transform IT and the enterprise.
Maximizing your infrastructure through virtualization
Virtualization continues to be one of the most effective ways to consolidate, reduce cost, and make data centers more efficient.
Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.