简体   繁体   中英

DbGeography's FromText throwing error in c#

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图像抛出错误

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM