Reputation: 701
I am trying to parse an xml file which contains spatial references and I've come to a standstill when trying to create the following polygon.
To try and overcome this I have been using SSMS to try and debug my problem.
I am using SQL 2012 Express.
XML Source Data
<Polygon>
<Position latitude="-62" longitude="-114" />
<Position latitude="34" longitude="-114" />
<Position latitude="34" longitude="62" />
<Position latitude="-62" longitude="62" />
<Position latitude="-62" longitude="-114" />
</Polygon>
SQL Query
DECLARE @geom geography
SELECT @geom = geography::STGeomFromText('POLYGON((
-62 -114,
34 -114,
34 62,
-62 62,
-62 -114
))',4326)
SQL Exception
Msg 6522, Level 16, State 1, Line 13
A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
System.FormatException: 24201: Latitude values must be between -90 and 90 degrees.
Thanks very much for any info Adam
Upvotes: 0
Views: 1083
Reputation: 701
Correct. I was inputting these in the wrong order.
Thanks everyone!!
Upvotes: 1
Reputation: 28727
According to Microsofts sample code the order is obviously longitude, latitude, while you exchanged that.
Upvotes: 2