Feeds

Microsoft measures up

A meter is a meter is a meter. Not

High performance access to file storage

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.

High performance access to file storage

More from The Register

next story
Windows 8.1, which you probably haven't upgraded to yet, ALREADY OBSOLETE
Pre-Update versions of new Windows version will no longer support patches
Android engineer: We DIDN'T copy Apple OR follow Samsung's orders
Veep testifies for Samsung during Apple patent trial
OpenSSL Heartbleed: Bloody nose for open-source bleeding hearts
Bloke behind the cockup says not enough people are helping crucial crypto project
Microsoft lobs pre-release Windows Phone 8.1 at devs who dare
App makers can load it before anyone else, but if they do they're stuck with it
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
Windows XP still has 27 per cent market share on its deathbed
Windows 7 making some gains on XP Death Day
Internet-of-stuff startup dumps NoSQL for ... SQL?
NoSQL taste great at first but lacks proper nutrients, says startup cloud whiz
US taxman blows Win XP deadline, must now spend millions on custom support
Gov't IT likened to 'a Model T with a lot of things on top of it'
prev story

Whitepapers

Mainstay ROI - Does application security pay?
In this whitepaper learn how you and your enterprise might benefit from better software security.
Five 3D headsets to be won!
We were so impressed by the Durovis Dive headset we’ve asked the company to give some away to Reg readers.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Mobile application security study
Download this report to see the alarming realities regarding the sheer number of applications vulnerable to attack, as well as the most common and easily addressable vulnerability errors.