[postgis-users] Make a shorter line from a given line

Daniel Grum daniel.grum at unibw.de
Wed Sep 9 12:19:37 PDT 2009


pcreso at pcreso.com schrieb:
> It sounds like you could use the linear referencing capability, along the lines of (untested, just off the top of my head)...
>
> select 
> makeline(st_line_interpolate_point(geom,1-((st_length(geom)-100)/st_length(geom))),endpoint(geom))
>
>
> ie, make you new line the percentage along the original line required by your offset for the start point, and the endpoint remains the same.
>
>
> HTH,
>
>   Brent Wood
>
>
> --- On Thu, 9/10/09, Daniel Grum <daniel.grum at unibw.de> wrote:
>
>   
>> From: Daniel Grum <daniel.grum at unibw.de>
>> Subject: Re: [postgis-users] Make a shorter line from a given line
>> To: nicklas.aven at jordogskog.no
>> Cc: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
>> Date: Thursday, September 10, 2009, 5:50 AM
>> nicklas.aven at jordogskog.no
>> schrieb:
>>     
>>> look at st_scale
>>> http://www.postgis.org/documentation/manual-1.4.1SVN/ST_Scale.html
>>>   or maybe st_transscale
>>> http://www.postgis.org/documentation/manual-1.4.1SVN/ST_TransScale.html
>>> /Nicklas
>>>    
>>> 2009-09-08 Daniel Grum wrote:
>>>
>>> Hy,
>>>       
>>>> I want to make a new line from a given line
>>>>         
>> -->both geometry types are
>>     
>>>> MULTININESTRING
>>>>
>>>> Every step the new line should be "x meters"
>>>>         
>> shorter than the original.
>>     
>>>> I get the length of the line, f.e. 5000 meters
>>>>         
>> (length(the_geom)) and
>>     
>>>> after the step the new Line should be only 4000
>>>>         
>> meters.
>>     
>>>> I have a idea but it isn't ready:
>>>>
>>>> UPDATE table
>>>> SET the_geom = (SELECT
>>>>         
>> MakeLine(StartPoint(line.the_geom),
>>     
>>>> EndPoint(line_merge(line.the_geom)))
>>>> FROM public.table line
>>>> ORDER BY line.gid);
>>>>
>>>> But in if I do so I have no chance to say that the
>>>>         
>> new line has to be
>>     
>>>> 100meters shorter than the original line.
>>>>
>>>> Are there any ideas how I can solve this problem?
>>>>
>>>> Thanks,
>>>> --Daniel
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users at postgis.refractions.net
>>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>>
>>>>
>>>>         
>> That is not what I'm searching for.
>>
>> Becaus the line lies somewhere in the 2D space and the end
>> point of the line anytime will be the same in my case...only
>> the starting point should be changed.
>> And it should be changed automaticly, step by step, and the
>> new starting point hvave to be on the old
>> line/route-->like a route in a map and every time step
>> the route will be shorter, because the unit has solved x
>> meters.
>>
>> Do you know what I mean?
>>
>> Scale and TransScale isn't the right finction I think.
>> --daniel
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>     
>
>   
A very good idea.
I try to understand it..what do you want to solve with:

1-((st_length(geom)-100)/st_length(geom))

should this be a percantage part of the original line...I don't 
understand it than.

I think we are on a good way...

--daniel



More information about the postgis-users mailing list