-1

I am developing asp.net MVC4 application with Google maps API.

I am using sql geography data type to store Point, polygon or polyline on the map.

problem is when i am drawing small area map using polygon or polyline its working fine and saved in DB as well.

But when i draw big area then the following error occurs from sql server side.

is anyone has idea why this happening?

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.
System.FormatException: 
   at Microsoft.SqlServer.Types.GeographyValidator.ValidatePoint(Double x, Double y, Nullable`1 z, Nullable`1 m)
   at Microsoft.SqlServer.Types.Validator.AddLine(Double x, Double y, Nullable`1 z, Nullable`1 m)
   at Microsoft.SqlServer.Types.ForwardingGeoDataSink.AddLine(Double x, Double y, Nullable`1 z, Nullable`1 m)
   at Microsoft.SqlServer.Types.CoordinateReversingGeoDataSink.AddLine(Double x, Double y, Nullable`1 z, Nullable`1 m)
   at Microsoft.SqlServer.Types.WellKnownTextReader.ParseLineStringText()
   at Microsoft.SqlServer.Types.WellKnownTextReader.ParsePolygonText()
   at Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText(OpenGisType type)
   at Microsoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisType type, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeography.ParseText(OpenGisType type, SqlChars taggedText, Int32 srid)
   at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
geocodezip
  • 158,664
  • 13
  • 220
  • 245
user2110346
  • 25
  • 1
  • 8
  • The obvious answer is because you are attempting to save something as a Latitude that is bigger than 90 or less than -90. Do you have your Latitude and Longitude reversed? – geocodezip Jun 11 '13 at 12:21
  • thanks for your answer, but my data is in this format => 'POLYGON((29.22889003019423 71.279296875,16.720385051694 78.75,29.84064389983441 94.39453125,29.22889003019423 71.279296875))' now for this polygon error mesage come from sql server is System.FormatException: 24201: Latitude values must be between -90 and 90 degrees. So how do i check / find degrees for this type of records. i am saving this record into db like this geography::STGeomFromText([MappingData],4326) please reply thanks – user2110346 Jun 11 '13 at 12:37

1 Answers1

1

94.39453125 is greater than 90.

29.84064389983441 94.39453125

From your POLYGON:

 'POLYGON((29.22889003019423 71.279296875,16.720385051694 78.75,29.84064389983441 94.39453125,29.22889003019423 71.279296875))' 
geocodezip
  • 158,664
  • 13
  • 220
  • 245