Convert geometry to lat and long

I found in my database that the store layout is represented as a geometry data type.

Is it possible to convert to lat and long coordinates and use it as an input for bing cards?

enter image description here

+7
source share
3 answers

This works for geometry types in sql server

 SELECT [Geometry].STX AS [Longitude], [Geometry].STY AS [Latitude] FROM YourTable 
+8
source

The magic 8-ball says: β€œAll the signs indicate yes. The documentation shows the Lat and Long methods. So, you would do:

 select Geometry.Lat as [Latitude], Geometry.Long as [Longitude] from dbo.your_table 

By the way, if you have the opportunity to change the name of this column, do it; you will not call a column with integer data type "int".

+2
source

The message is a bit outdated, but ...

You need to use some resource that can make predictions. Many stores have access to ESRI REST Geometry services, and the general open service is Project .

The following are the manual steps that you can repackage into a script / procedure using regular DB tools:

- QA data from a known point with ShapeGeom

 select top 1 ShapeGeom.ToString(),Lat,Long from My_ADDRESS_POINTS 

returns: POINT (5786835.7214864492 2235317.366254434) 35.10721420 -120.59089280

- extract / reformat x, y from POINT: 5786835.7214864492,2235317.366254434

- REST call - your path will be different.

 --Use inSR with the SRID of your Geometry data select top 1 ShapeGeom.STSrid from My_ADDRESS_POINTS 

- HTTP ???? / Other / services / Utilities / Geometry / GeometryServer / Project inSR = 2229 &? OutSR = 4251 & geometry = + 5786835.7214864492% 2C + +2235317.366254434 & F = JSON

- result:

 { "geometries": [ { "x": -120.59089279999577, "y": 35.107214200388704 } ] } 
+1
source

All Articles