Sunday, 8 October 2017

postgis - Can ST_Segmentize create equal length segments?


SELECT ST_AsText(ST_Segmentize(ST_GeomFromText('LINESTRING(0 0, 10 0)'), 3)); gives LINESTRING(0 0,3 0,6 0,9 0,10 0) but the expected result is LINESTRING(0 0,2.5 0,5 0,7.5 0,10 0). How can this be done?


See for example the documentation for qgis:densifygeometriesgivenaninterval:



"E.g. specifying a distance 3 would cause the segment [0 0] -> [10 0] to be converted to [0 0] -> [2.5 0] -> [5 0] -> [7.5 0] -> [10 0], since 3 extra nodes are required on the segment and spacing these at 2.5 increments allows them to be evenly spaced over the segment."





No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...