0

I am using System.Data.Entity.Spatial.DbGeography.FromText() method to convert the Google map geographical json data to DbGeography data type to save it into SQL database. Sometimes its throwing the error

"24201: Latitude values must be between -90 and 90 degrees."

Following are the polygon points which I have drawn on United States and its throwing error while conversion:

POLYGON(( 40.6806380252146 -106.8310546875, 40.6639728763869 -93.7353515625, 34.8318411498286 -93.27392578125, 37.9788450404971 -97.84423828125, 35.3890499669117 -98.96484375, 38.3244204270065 -100.43701171875, 35.3173663292379 -102.48046875, 38.5481654230466 -103.60107421875, 35.5143431343182 -104.9853515625, 37.7880813841205 -105.93017578125, 36.6155276313492 -111.26953125, 38.8397076135451 -107.7978515625, 38.685509760012 -111.24755859375, 40.111688665596 -108.74267578125, 38.8568201347436 -105.79833984375, 40.6806380252146 -106.8310546875))

Even its throwing error with below points:

POINT(39.2369068303763 -105.542221069336)

Plolygon Image Which is throwing error

its4zahoor
  • 1,709
  • 1
  • 16
  • 23
Yashpal S
  • 299
  • 4
  • 16

1 Answers1

0

Does POINT(-105.542221069336 39.2369068303763) give you what you expect?

If so it seems likely the terms are reversed from what you are expecting.

Loofer
  • 6,841
  • 9
  • 61
  • 102
  • Hi @Loofer, Thanks for your reply, as suggested by you, I reversed it and tried but its still working, below are the points: POINT(38.8953082549202 -122.406921386719). Also I am putting Google GeoJson data from which I am converting it: {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.40692138671875,38.89530825492018]},"properties":{"radius":22135.604384534414}}]} – Yashpal S Dec 11 '17 at 04:48