Skip to content Skip to sidebar Skip to footer

Sql Server Geography Latitude Longitude Error

I'm using geography data type for calculating shortest distance. CREATE TABLE Landmark ( Id int, Latitude FLOAT, Longitude FLOAT ) INSERT Landmark VALUES (1, 49.2

Solution 1:

It looks like you've got the latitude and longitude switched. A couple of things:

  1. An easy sanity check is to use the Lat and/or Long extended properties. Here is the doc for Long.

  2. Another extension that Microsoft's implementation provides is the Point static method for creating points. So instead of having to create the WKT for a point to pass to STPointFromText, you can just do geography::Point(Latitude, Longitude, SRID). Here is the doc for that.

Post a Comment for "Sql Server Geography Latitude Longitude Error"