question

SQLhelp avatar image
SQLhelp asked

Grab Point cooridinates from Geometry Collection SQL Server

Hi All, I have a spatial geometry field in SQL Server containing a geometry collection: e.g. [GeometryField].STAsText() = GEOMETRYCOLLECTION (POLYGON ((445559.05 108565.15, 445554.6 108571.35, 445552.95 108573.85, 445545.6 108583.95, 445552.8 108589, 445567.8 108567.7, 445560.8 108562.7, 445559.05 108565.15)), POINT (445556.64 108574.1)) The geometry field contains both a point and polygon, the point can be wrapped around the Geometry collection field in the beginning or end. How can I write a query to grab the POINT coordinates only.
sql server 2012ssmssql queryspatialgeometry
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Jon Crawford avatar image
Jon Crawford answered
Use a split function, much easier. Look at Jeff Moden's DelimitedSplit8k (article by Wayne Sheffield here with tons of info [link text][1] [1]: http://www.sqlservercentral.com/articles/139338/
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Deleted my previous comment. I like this solution a lot more.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.