I am trying to create a geography polygon (a simple box) for SQL Server 2008 spatial types:
select geography::STPolyFromText('POLYGON((18.123632669448853 59.299458646827844,
18.103247880935669 59.299458646827844, 18.103247880935669 59.304935824311556,
18.123632669448853 59.304935824311556, 18.123632669448853 59.299458646827844))'
, 4326)
I keep getting "The specified input does not represent a valid geography instance." and I cannot understand what's wrong with it. If I use LINESTRING to plot each line of the box in the Spatial Results view of the SQL MGM Studio, everything looks fine.
If I put开发者_开发问答 a minus sign in front of all the longitudes it can be created too (but obviously it is not the same).
For some reason, exterior rings of a polygon have to be defined in anti-clockwise order; interior rings clockwise. So swap your second and fourth points over and you should be good.
精彩评论