Asked • 04/11/19

Geometry datatype to latitude /Longitude MS SQL Server?

I need to convert Sql Server geometry datatype to latitude /Longitude I have just imported a shapefile to my table (geometry) This query does not work:- select geom.Lat as [Latitude], geom.Long as [Longitude] from dbo.special     Error I get is: >Could not find property or field 'Lat' for type 'Microsoft.SqlServer.Types.SqlGeometry' in assembly 'Microsoft.SqlServer.Types'. This query returns Latitude and longitude but the format doesnot seem to match google maps:-  select U.name, Centroid.STY as Longitude, Centroid.STX as Latidude from ( select geom.STCentroid() as Centroid, NAME from dbo.special) Also:- SELECT ST_X (ST_Transform (geom, 4326)), ST_Y (ST_Transform (geom, 4326)) FROM special  gives >'ST_Transform' is not a recognized built-in function name.   Please suggest

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.