How can PostGIS shorten the end segments of polylines?
I already figured out how to calculate the length of the shortest end segment of any end of any polyline in
select min(least) from (select least (ST_Length (ST_MakeLine (ST_PointN(geom, 1), ST_PointN(geom, 2))), ST_Length (ST_MakeLine (ST_PointN(geom, ST_NPoints(geom) - 1), ST_PointN(geom, ST_NPoints(geom))))) from (select (ST_Dump(geom)).geom as geom from my_table) as polylines) as a;
Now I just want to shorten both end segments of every polyline with 1/3 of that value. (So that a polyline with a single segment will still consist of the middle 1/3 of the original.)