문제

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

도움이 되었습니까?

해결책 2

Correct. I was inputting these in the wrong order.

Thanks everyone!!

다른 팁

According to Microsofts sample code the order is obviously longitude, latitude, while you exchanged that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top