Re: [postgis-users] Shifting linestrings left
G'day Sean, On 24/12/2010, at 2:07 AM, Sean wrote: > Is this just a visualization issue? You could store copies of the the > road line with attribute data indicating direction or have a separate > table with foreign keys to the geography and the direction data. > > Then, you just symbolize differently based on the attributes. Offset > the symbology not the geometry. This is more correct, it preserves > the information about the actual road on which they travel. Showing > direction of travel is strictly a symbology issue. It's a mix of both - initially, it was a geometry issue - I have linestrings for roads, and for some I have information that suggests that they are dual carriageway, and I was wondering if we could approximate the dual carriageway by shifting the original geometry a little bit to the left going each way. Then I realised I had better things to do, so I moved on, but now I have a need to show routes going both ways, but using pgRouting they (unsurprisingly) following the same lines, and I wanted to show it. Using QGIS I offset the symbology, but it doesn't actually seem to works how I wanted (which is nicely described by Simon's post), but rather looks like : <> cheers (and Happy Christmas etc) Ben___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Shifting linestrings left
G'day Puneet, On 24/12/2010, at 2:17 AM, Puneet Kishor wrote: > Sean wrote: >> Is there a way to 'shift' the linestring to the left - after all, > > that would be sensible side of the road to drive on... > > Which world do you live in? After all, the right side of the road is called > the "right side" for a reason. I thought my accent would have given that away by now! ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Shifting linestrings left
Sean wrote: Is there a way to 'shift' the linestring to the left - after all, > that would be sensible side of the road to drive on... Which world do you live in? After all, the right side of the road is called the "right side" for a reason. ;-) -- Puneet Kishor ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Shifting linestrings left
Is this just a visualization issue? You could store copies of the the road line with attribute data indicating direction or have a separate table with foreign keys to the geography and the direction data. Then, you just symbolize differently based on the attributes. Offset the symbology not the geometry. This is more correct, it preserves the information about the actual road on which they travel. Showing direction of travel is strictly a symbology issue. Sean On Dec 22, 9:13 pm, Ben Madin wrote: > 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-us...@postgis.refractions.nethttp://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Shifting linestrings left
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 > wrote: > >> Thanks Brent, >> >> Happy Christmas / New Year to you as well! >> >> On 23/12/2010, at 2:07 PM, pcr...@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 wrote: >>> >>> From: Ben Madin >>> Subject: [postgis-users] Shifting linestrings left >>> To: "PostGIS Users Discussion" >>> 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@postgis.refractions.net >>> http://postgis.refractions.net/mailman/listinfo/postgis-users >> >> ___ >> postgis-users mailing list >> postgis-users@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: si...@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@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Shifting linestrings left
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 wrote: Thanks Brent, Happy Christmas / New Year to you as well! On 23/12/2010, at 2:07 PM, pcr...@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 wrote: From: Ben Madin Subject: [postgis-users] Shifting linestrings left To: "PostGIS Users Discussion" 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@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@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: si...@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@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Shifting linestrings left
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, pcr...@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 wrote: From: Ben Madin Subject: [postgis-users] Shifting linestrings left To: "PostGIS Users Discussion" 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@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Shifting linestrings left
Thanks Brent, Happy Christmas / New Year to you as well! On 23/12/2010, at 2:07 PM, pcr...@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 wrote: > > From: Ben Madin > Subject: [postgis-users] Shifting linestrings left > To: "PostGIS Users Discussion" > 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@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Shifting linestrings left
Hey Ben... Seasons greetings!! You have a couple of options: 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 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 Cheers, Brent For more complex shifting of features, probably overkill in your case, see http://postgis.refractions.net/documentation/manual-svn/ST_Affine.html --- On Thu, 12/23/10, Ben Madin wrote: From: Ben Madin Subject: [postgis-users] Shifting linestrings left To: "PostGIS Users Discussion" 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@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Shifting linestrings left
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@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users