I have a multilinestring that is approximately 9700 meters long. My goal is to merge the multilinestring into a single 9700m linestring, then split the merged linestring into 97 linestrings of 100m lengths. When using the query below (taken from the docs for ST_LineSubstring), I get the expected results, but I cannot view the results in QGIS. I suspect I am not understanding something conceptual about the coordinate system?
The SRID for
4326 and I'm using PostGIS 2.2.1.
SELECT ST_LineSubstring(the_geom, 100.00*n/length, CASE WHEN 100.00*(n+1) < length THEN 100.00*(n)/ length ELSE 1 END) AS the_geom FROM ( SELECT ST_LineMerge(geom) AS the_geom, ST_Length(geom::geography) AS length FROM public."subdivide_lineTesting" ) AS t CROSS JOIN generate_series(0,10000) AS n WHERE n*100.00/length < 1
Also, a side observation: When I count the number of points in the geometry produced using the below query, every tuple is null except for the last one. That record shows an expected 2 points.
st_numpoints(ST_LineSubstring(the_geom, 100.00*n/length, CASE WHEN 100.00*(n+1) < length THEN 100.00*(n)/ length ELSE 1 END)) as points