Spatial SQL -> MS-SQL 2008. Extract coordinates of polygon center

This script shows how you can extract coordinates of polygon center:

-- Extract Lat\Long coordinates of GEOGRAPHY centroid

SELECT geog.EnvelopeCenter(),
       geog.EnvelopeCenter().Long, geog.EnvelopeCenter().Lat
FROM Buldings;


-- Extract X\Y coordinates of GEOMETRY centroid

SELECT geom.STCentroid(),
       geom.STCentroid().STX, geom.STCentroid().STY
FROM Buldings;





sqlexamples.info