[postgis-users] Shifting linestrings left

Charles Galpin cgalpin at lhsw.com
Thu Dec 23 05:55:34 PST 2010


Just FYI, I have tries upgis_lineshift and in general it does a great job - at a minimum for visualizing the different paths. However I have found that sometimes the shifted line doesn't go in the direction you'd expect so you'll get situations where the shifting switches sides and this can be problematic if you are expecting them to represent the actual side of the road of that lane.

In the diagram below the …… line is the original geometry for a singly digitized road, and the - - -  is the shifted line. 

- - - - - - - - - -
……………………………...
                      - - - - - - - - - - - 

I have not had time to look into this, but hope to at some point.

hth
charles

On Dec 23, 2010, at 1:03 AM, Simon Greener wrote:

> Ben,
> See Regina Obe's upgis_lineshift
> http://trac.osgeo.org/postgis/wiki/UsersWikiplpgsqlfunctions
> I have a PostGIS version, without the curves, of this one:
> http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/97/implementing-a-move-parallel-function-for-sdo_geometry-linestring-data-in-oracle
> If you want the code, email me privately as I have not yet blogged on it.
> Simon
> On Thu, 23 Dec 2010 14:56:49 +1100, Ben Madin <lists at remoteinformation.com.au> 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
>> 
> 
> 
> -- 
> SpatialDB Advice and Design, Solutions Architecture and Programming,
> Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional
> Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.
> 39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
> Website: www.spatialdbadvisor.com
>  Email: simon at spatialdbadvisor.com
>  Voice: +61 362 396397
> Mobile: +61 418 396391
> Skype: sggreener
> Longitude: 147.20515 (147° 12' 18" E)
> Latitude: -43.01530 (43° 00' 55" S)
> GeoHash: r22em9r98wg
> NAC:W80CK 7SWP3
> _______________________________________________
> 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