[pgrouting-users] Setting the tolerance argument in assign_vertex_id

Dan Putler putler at yahoo.com
Fri Aug 27 03:44:42 EDT 2010


Thanks a lot Steve, this looks really helpful. I can see that routing involves much of the same "art" that geocoding does.

Based on past experience, I'm not sure that the road network I am working with is as clean as you and Daniel appear to assume. I'm going to look at the dead-end and other issues tomorrow. I'm also wondering if there is any potential benefit of reading the original shapefile into GRASS which will attempt to clean it, dumping it back into a shapefile from GRASS, and then importing it into PostGIS, or does assign_vertex_id basically do the same cleaning that GRASS does?

Dan

--- On Thu, 8/26/10, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:

> From: Stephen Woodbridge <woodbri at swoodbridge.com>
> Subject: Re: [pgrouting-users] Setting the tolerance argument in assign_vertex_id
> To: "Dan Putler" <putler at yahoo.com>
> Cc: "pgRouting list" <pgrouting-users at lists.osgeo.org>
> Received: Thursday, August 26, 2010, 8:55 PM
> Dan,
> 
> I think that picking a number around 0.5 to 1 meter should
> be fine for 
> that data. In general it is unlikely that you will have
> nodes that are 
> NOT connected but that close together.
> 
> You can also do some analysis of the results like this,
> after you run 
> assign_vertex_id():
> 
> alter table vertices_tmp add column cnt int;
> update vertices_tmp set cnt = (select count(*) from
> "<edge_table>"
>     where vertices_tmp.id=target or
> vertices_tmp.id=source);
> select cnt as connections, count(*) from vertices_tmp
>     group by cnt order by cnt;
> 
> This will analyze the connectedness of you network.
> 
> connections
>    1   - dead ends
>    2   - segments connected
> but only an intersection if different names
>    3+  - intersections
> 
> If you run assign_vertex_id() with different tolerance
> values and then 
> run this analysis as your tolerance gets too big you will
> see a shift of 
> these numbers to the smaller end which is bad.
> 
> Another important analysis you check is:
> 
> select count(*) from "<edge_table>" where
> target=source;
> 
> this count should be zero unless you have zero length
> segments in your 
> data and you can check that with:
> 
> select gid, st_length(the_geom) from "<edge_table>"
> where target=source;
> 
> These are a good way to learn about your data.
> 
> -Steve
> 
> 
> On 8/26/2010 8:37 PM, Dan Putler wrote:
> > Thanks Steve, but I do need a bit of a follow on I
> think, and
> > probably provide a bit more explanation.
> >
> > I'm using a DMTI CanMap routing layer for BC that
> started out in
> > NAD83 geographic, which I converted to NAD83 UTM Zone
> 10N via
> > ogr2ogr, I also shrank it down using a "with"
> statement in ogr2ogr to
> > cover only part of the province. After I sent my
> email, I did a bit
> > more Google searching and based on a question in the
> pgRouting forum,
> > a user using NAVTEQ layers was using a tolerance that
> worked out to
> > between 1 and 1.5 meters. Based on this, I set the
> tolerance to 2
> > meters, it sounds like I should set the tolerance in
> assign_vertex_id
> > to be much smaller (say 0.15 meters, which is just
> over 5 inches).
> >
> > In general, is it better to err on the side of too
> small or too large
> > a tolerance, or is that a "it depends" question?
> >
> > Dan
> >
> > --- On Thu, 8/26/10, Stephen Woodbridge<woodbri at swoodbridge.com>
> > wrote:
> >
> >> From: Stephen Woodbridge<woodbri at swoodbridge.com>
> Subject: Re:
> >> [pgrouting-users] Setting the tolerance argument
> in
> >> assign_vertex_id To: "Dan Putler"<putler at yahoo.com>
> Cc: "pgRouting
> >> list"<pgrouting-users at lists.osgeo.org>
> Received: Thursday, August
> >> 26, 2010, 4:27 PM On 8/26/2010 2:51 PM, Dan Putler
> wrote:
> >>> Hi,
> >>>
> >>> I'm curious how to determine the value of the
> second
> >> argument in the
> >>> function assign_vertex_id(). Most of the
> examples I
> >> can find look
> >>> like:
> >>>
> >>> assign_vertex_id('<edge table>', 0.001,
> >> 'the_geom', 'gid')
> >>>
> >>> Most of the examples are based on edge tables
> that
> >> have SRIDs that
> >>> correspond to either WGS84 geographic or some
> sort of
> >> US State Plane
> >>> feet. I'm using data that is using a UTM
> coordinate
> >> SRID, so the map
> >>> units are in meters. My question is whether
> the map
> >> units should
> >>> influence the choice of the second argument to
> the
> >> function (which I
> >>> assume is a tolerance between edges), or
> should I just
> >> keep with the
> >>> value 0.001? Implicitly, I'm asking if the
> parameter
> >> is in the map
> >>> units of the SRID.
> >>
> >> Dan,
> >>
> >> Right units is important.
> >>
> >> When I use data in WGS84 that has at lease 6
> decimal places then I
> >> use 0.000001 as the tolerance. What this means if
> that if the
> >> distance between two points are less than or equal
> 0.000001 units
> >> then they should be considered the same point.
> 0.000001 degrees ==
> >> ~5 inches if I did the math right.
> >>
> >> I think there are two issues you need to be aware
> of:
> >>
> >> 1) units 2) your data and what precision it was
> built at
> >>
> >> HTH, -Steve
> >>
> >>
> >
> >
> 
> 




More information about the Pgrouting-users mailing list