I am currently in the process of integrating Google Maps into one of our applications. One of the requirements is to store a user defined area into the database. To do this I have been using the Geography type in SQL Server 2008. While I have got it working for the most part I have come across a blocking issue.
Below I have some example code. I am populating the Geography object with a GML XML string and some instances work and some don’t and I can’t see a logical reason why they don’t.
DECLARE @geoWork GEOGRAPHY
DECLARE @geoNotWork GEOGRAPHY
DECLARE @Work NVARCHAR(MAX)
DECLARE @DoesntWork NVARCHAR(MAX)
SET @Work = '<Polygon xmlns="http://www.opengis.net/gml">'
'61.52269494598361 -6.50390625 50.84757295365389 -36.5625 32.69486597787505 -17.40234375 46.31658418182218 23.90625 61.52269494598361 -6.50390625' +
SET @DoesntWork = '<Polygon xmlns="http://www.opengis.net/gml">'
'51.8591074413996 -0.8425140380859375 51.790355567911845 -0.7051849365234375 51.75381501386028 -0.8191680908203125 51.80564283054998 -0.9180450439453125 51.8591074413996 -0.8425140380859375' +
SET @geoWork = GEOGRAPHY::GeomFromGml(@Work, 4326)
SET @geoNotWork = GEOGRAPHY::GeomFromGml(@DoesntWork, 4326)
The polygon that is working defines a huge area (spanning the size of several countries) whereas the one that doesn’t defines one about the size of a large town. It is only these “smaller” areas that are failing. Annoyingly this smaller one doesn’t go small enough for what I need it for. Can anyone tell me why this is happening?