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.
1 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.
geometry::STGeomFromWKB([WKBGeom],0).STBoundary().STCurveN(Index)
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.