Friday, 16 September 2016

sql server - what is the format of Geometry data type of SQLServer 2008


I want to know, In which format the Geographic data stored in geometry data type of SQLServer 2008.it looks like a long string,like 0xE6100010466DFEOA4089663524....... for one polygon. My second question is How can i get set of google latitudes/longitudes from this data format ?



Answer



It's binary data, you need to use the STAsText() method to return it as a string that contains the lat/longs, as in:


SELECT [OBJECTID]
,[TRACT_ID]

,[TRACT_NAME]
,[SHAPE].STAsText()
FROM [City].[dbo].[TRACTS]

To go the other way, use the STAsBinary() method.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...