4

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
    Damn it - was so hoping there would be an answer here :( – Pure.Krome Aug 14 '13 at 2:45
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.