[postgis-users] Shifting linestrings left

Andreas Neumann a.neumann at carto.net
Wed Dec 22 21:51:54 PST 2010


Hi Ben,

What you want are single sided, open buffers - or one could also call it 
"ST_Parallel(the_geom,distance)". This doesn't exist yet in Postgis, 
though I believe that geos (the underlying geometry engine) already 
supports it (at least the single-sided buffer - not sure about the open 
buffers).

See 
http://geos.osgeo.org/doxygen/classgeos_1_1operation_1_1buffer_1_1BufferBuilder.html 
- there is a bufferLineSingleSided function available.

So I believe that the single sided part would be a matter of exposing 
the geos functionality in Postgis - the "open buffer" part would be 
perhaps more work.

Andreas

On 12/23/2010 04:56 AM, Ben Madin wrote:
> Thanks Brent,
>
> Happy Christmas / New Year to you as well!
>
> On 23/12/2010, at 2:07 PM, pcreso at pcreso.com wrote:
>
>> ST_Translate() is the simplest, but if your lines are horizontal you may want a Y shift as well?
>>
>> http://postgis.refractions.net/documentation/manual-svn/ST_Translate.html
> Lines are roads, so they go every which way.
>
>> Having done this, I suggest you also use ST_reverse() to reflect the direction is now going the other way (unless it already is :-)
>> http://postgis.refractions.net/documentation/manual-svn/ST_Reverse.html
>>
>> For more complex shifting of features, probably overkill in your case, see
>> http://postgis.refractions.net/documentation/manual-svn/ST_Affine.html
> This might be what I am after, but I was thinking of somehow translating each segment parallel to it's current alignment and then rejoining with a nice smooth curve... kind of like a 1-sided buffer.
>
> cheers
>
> Ben
>
>
>
>
>
>> --- On Thu, 12/23/10, Ben Madin<lists at remoteinformation.com.au>  wrote:
>>
>> From: Ben Madin<lists at remoteinformation.com.au>
>> Subject: [postgis-users] Shifting linestrings left
>> To: "PostGIS Users Discussion"<postgis-users at postgis.refractions.net>
>> Date: Thursday, December 23, 2010, 3:13 PM
>>
>> G'day all,
>>
>> I have a problem where I am trying to show the route of livestock movements, but I am loosing information when the travel along the same road in different directions (ie in some cases they travel from a saleyard to a feedlot, then back to the saleyard after a period). The roads they travel along are single linestrings.
>>
>> Is there a way to 'shift' the linestring to the left - after all, that would be sensible side of the road to drive on...
>>
>> cheers
>>
>> Ben
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list