0

when I am converting polygon text to sqlGeography object I get error "24201: Latitude values must be between -90 and 90 degrees." Polygon example which throws error:

  POLYGON((58.197682 -151.896133,58.26688 -151.839327,58.256878 -151.79607,58.186908 -151.807954,58.165101 -151.863333,58.197682 -151.896133))

enter image description here There is realated question but no answer for it: DbGeography's FromText throwing error in c#

I though it can convert fine and "MakeValid()" is fixing it - and in some previous cases it did work. I got "US States" GEOJSON from this page: https://exploratory.io/map

How to fix that conversion to sqlGeography was handled successfully?

Martin Schmelzer
  • 23,283
  • 6
  • 73
  • 98
Drasius
  • 825
  • 1
  • 11
  • 26
  • Also there is "https://stackoverflow.com/questions/50702423/invalid-latitude-value-must-be-between-90-and-90" realated answer. But swamping lat/long places did not help - as they are correct now. If I swam - polygons would get in different place than expected. – Drasius May 19 '20 at 11:13
  • Some other wiki related to question: https://danielwertheim.se/sqlgeography-in-sql-server-2012-polygon-must-start-on-correct-position/ – Drasius May 19 '20 at 11:21
  • I know this is a somewhat older question but you refer to swapping lat/long as being wrong when it is in fact absolutely correct. In text strings when working with the geography types, the coordinates are `X Y`. This makes geometry/geography coordinates both work the same way but means that it's `Long Lat`, which is the opposite of the usual convention. Swapping is the right thing to do, and means that you polygons *actually end up in the right place*. Your polygons are currently *consistently wrong*. – Damien_The_Unbeliever Aug 06 '20 at 07:13

0 Answers0