Given a polygon (no multipolygons, or holes) what is the best way to explode it into lines using T-SQL. The end results is I need a record for each line that makes up the polygon.
[GIS] Polygons to Lines SQL Server 2008/2012
sql server
sql server
Given a polygon (no multipolygons, or holes) what is the best way to explode it into lines using T-SQL. The end results is I need a record for each line that makes up the polygon.
Best Answer
It's late answer, but better late than never.
I had same problem and solved it by using STCurveN() for getting Nth line. But, this function doesn't work with polygons, so I converted polygon into LineString using STBoundary(). Now, STCurveN() works great and you can do whatever you want with it.
This is an example of using all of this. You can make loop, put counter instead of 'Index' and get all lines from polygon in a result set.