3

For Example I have simple linestring 'LINESTRING(25 50, 100 125, 150 190)' and I need to divide it to segments of length 10. In postgis i know there is a function ST_Segmentize but what about MS SQL Server?

1 Answer 1

4

You are after the SQL Server Spatial Tools extras for SQL Server 2008. Find them and the descriptions at

http://sqlspatialtools.codeplex.com/wikipage?title=Current%20Contents&referringTitle=Home

Be aware that after you install, you have to trust the assembly as well.

Once you have these installed, then it given you a few more options. One of which is to LocateAlongGeom, which will give you a point a given distance in whatever the units are of the geometry along the line.

select dbo.LocateAlongGeom(geometry::STGeomFromText('LINESTRING(25 50, 100 125, 150 190)',0),10)

2
  • thank you and I forgot to ask whether it will be capable of ms sql server express 2008? Mar 6, 2012 at 5:56
  • Yes you can use it in SQL SERVER 2008 Express, I just checked my local install and it works fine.
    – Kelso
    Mar 6, 2012 at 6:00

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.