[postgis-users] Getting x km of a linestring expressed in projection (3857)
Dave Potts
dave.potts at pinan.co.uk
Tue Nov 25 21:41:16 PST 2014
On 26/11/14 00:55, Mike Toews wrote:
Brilliant Mike,
Thank you Very much.
> Hi Dave,
>
> To use normalized distances between [0 1], rather than absolute
> distances between [0 length], divide your LRS distance by the total
> length. So for example, finding the first 2 km of a 10 km linestring:
>
> SELECT ST_AsEWKT(ST_Line_Substring(geom, 0.0, 2 * 1000 / ST_Length(geom)))
> FROM (SELECT 'SRID=3857;LINESTRING(0 0, 10000 0)'::geometry AS geom) AS f;
>
> st_asewkt
> ----------------------------------
> SRID=3857;LINESTRING(0 0,2000 0)
> (1 row)
>
> -Mike
>
> On 26 November 2014 at 11:53, Dave Potts <dave.potts at pinan.co.uk> wrote:
>> I like to extra the first x km from a linestring geometry with an srid id of
>> 3857, but I having problems working out how to do it.
>>
>> I known its possible to split a line using st_lineSubString, but that only
>> works in fractions off a length, I am interested in get it projection unit
>> lengths, are there any better suggestions??
>>
>> Dave.
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list