[postgis-users] Splitting/merging linework into equalintervallinestrings

Paragon Corporation lr at pcorp.us
Wed Jul 9 22:46:53 PDT 2008

 Duh - just realized I had one additional unnecessary sub select - I think
the below is crisper

SELECT gid,  ST_Line_Substring(the_geom, 500*n/length ,
CASE WHEN 500*(n+1) < length THEN 500*(n+1)/length ELSE 1 END) As the_geom
FROM    (SELECT ts.gid, ST_LineMerge(ts.the_geom) As the_geom,
ST_Length(ts.the_geom) As length FROM line_segments ts
		) t CROSS JOIN generate_series(0,10000) n 
WHERE n*500/length < 1

Sorry about that,

More information about the postgis-users mailing list