[pgrouting-users] Pgrouting-users Digest, Vol 92, Issue 3

HuanChun Ye huanchunye at athentek.com
Sat May 14 16:22:05 PDT 2016


Looking at the source code for function _pgr_pointToId() led me to try the
following snippets on edge_table:

pgr_test=# select st_distance(the_geom, st_geomfromtext('point(1.9999999999
3.5)', 4326)) as d from edge_table where
st_dwithin(st_geomfromtext('point(1.9999999999 3.5)' , 4326), the_geom,
0.001) order by d; d ----------------------- 0 1.00000008274037e-010 (2
rows) pgr_test=# select st_distance(the_geom,
st_geomfromtext('point(1.9999999999 3.5)', 4326)) as d from edge_table
where st_dwithin(st_geomfromtext('point(1.9999999999 3.5)' , 4326),
the_geom, 0.001) order by d limit 1; d --- 0 (1 row)

The first row is the "self geometry" to which the point belongs. However,
in _pgr_pointToId() there is a "ORDER BY d LIMIT 1", which would have pick
up only
the self geometry and miss the intended one. Could this be the problem?
Perhaps there should be a DESC?


On 14 May 2016 at 00:12, <pgrouting-users-request at lists.osgeo.org> wrote:

> Send Pgrouting-users mailing list submissions to
>         pgrouting-users at lists.osgeo.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.osgeo.org/mailman/listinfo/pgrouting-users
> or, via email, send a message with subject or body 'help' to
>         pgrouting-users-request at lists.osgeo.org
>
> You can reach the person managing the list at
>         pgrouting-users-owner at lists.osgeo.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Pgrouting-users digest..."
>
>
> Today's Topics:
>
>    1. Re: Pgrouting-users Digest, Vol 92, Issue 2 (HuanChun Ye)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 14 May 2016 00:12:15 -0700
> From: HuanChun Ye <huanchunye at athentek.com>
> To: pgrouting-users at lists.osgeo.org
> Subject: Re: [pgrouting-users] Pgrouting-users Digest, Vol 92, Issue 2
> Message-ID:
>         <CADxKYiSvdNhjKveK1Etj2AY79EAMbbEir=qy9Cmo_aKnPQ=
> qOQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Regina,
>
> Thanks for your quick response! I upgraded to 2.2.2 using stack builder
> with the following results:
>
>
> pgr_sample=# select version(), postgis_full_version(), pgr_version();
>                            version                           |
>
> postgis_full_version
>                                                         |
>  pgr_version
>
> -------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------
>
> --------------------------------------------------------+-----------------------------------------------
>  PostgreSQL 9.5.2, compiled by Visual C++ build 1800, 64-bit |
> POSTGIS="2.2.2 r14797" GEOS="3.5.0-CAPI-1.9.0 r4090" PROJ="Rel. 4.9.1, 04
> March 2015" GDAL="GDAL 2.0.2, re
> leased 2016/01/26" LIBXML="2.7.8" LIBJSON="0.12" RASTER |
> (2.2.2,pgrouting-2.2.2,544044b,master,1.59.0)
> (1 row)
>
>
> But unfortunately the same commands still produce the same results.
>
> Huanchun
>
>
> On 13 May 2016 at 22:24, <pgrouting-users-request at lists.osgeo.org> wrote:
>
> > Send Pgrouting-users mailing list submissions to
> >         pgrouting-users at lists.osgeo.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >         http://lists.osgeo.org/mailman/listinfo/pgrouting-users
> > or, via email, send a message with subject or body 'help' to
> >         pgrouting-users-request at lists.osgeo.org
> >
> > You can reach the person managing the list at
> >         pgrouting-users-owner at lists.osgeo.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Pgrouting-users digest..."
> >
> >
> > Today's Topics:
> >
> >    1. Re: Problem with topology using sample data in    the     manual
> >       (Regina Obe)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Sat, 14 May 2016 00:24:18 -0400
> > From: "Regina Obe" <lr at pcorp.us>
> > To: "'pgRouting users mailing list'" <pgrouting-users at lists.osgeo.org>
> > Subject: Re: [pgrouting-users] Problem with topology using sample data
> >         in      the     manual
> > Message-ID: <000001d1ad98$7b662120$72326360$@pcorp.us>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Quick note.
> >
> >
> >
> > There were some issues in pgRouting 2.2.0 released which this may be one
> > of them.  I pushed up pgRouting 2.2.2 in stackbuilder last week for
> > PostgreSQL 9.5 x windows 64-bit
> >
> >
> >
> > If you reinstall PostGIS bundle from stackbuilder and then do a
> >
> >
> >
> > ALTER EXTENSION pgRouting UPDATE;
> >
> >
> >
> > You should get the new version.
> >
> >
> >
> > For others on windows, sorry haven't had a chance to repackage.  I do
> have
> > binaries you can get  from here - http://postgis.net/windows_downloads/
> >
> >
> >
> > In the unreleased section – look for in respective pg version folder
> >
> >
> >
> > pgrouting-pg95-binaries-2.2.2w64gcc48.zip <
> >
> http://winnie.postgis.net/download/windows/pg95/buildbot/pgrouting-pg95-binaries-2.2.2w64gcc48.zip
> > >
> >
> >
> >
> >
> >
> > Where the 95, w64 will change depending on which version of PostgreSQL
> you
> > are running.
> >
> >
> >
> > These will be the same versions I'll be pushing up.
> >
> >
> >
> >
> >
> > Thanks,
> >
> > Regina
> >
> > From: Pgrouting-users [mailto:pgrouting-users-bounces at lists.osgeo.org]
> On
> > Behalf Of HuanChun Ye
> > Sent: Friday, May 13, 2016 11:57 PM
> > To: pgrouting-users at lists.osgeo.org
> > Subject: [pgrouting-users] Problem with topology using sample data in the
> > manual
> >
> >
> >
> > I am working through the examples in the manual (v2.2) using the sample
> > data, but encountered a problem with topology, as described below. I
> > apologize for the verbosity, but I want to show the exact steps leading
> to
> > the problem, starting with just after importing the sample data:
> >
> >
> >
> > pgr_sample=# select * from edge_table;
> >
> >  id | dir | source | target | cost | reverse_cost | x1  | y1  |       x2
> >      | y2  |                                      the_geom
> >
> >
> >
> >
> >
> ----+-----+--------+--------+------+--------------+-----+-----+----------------+-----+-----------------------------------------------------------------------------------
> >
> > -
> >
> >   1 | B   |        |        |    1 |            1 |   2 |   0 |
> >   2 |   1 |
> >
> 010200000002000000000000000000004000000000000000000000000000000040000000000000F03F
> >
> >   2 | TF  |        |        |   -1 |            1 |   2 |   1 |
> >   3 |   1 |
> >
> 0102000000020000000000000000000040000000000000F03F0000000000000840000000000000F03F
> >
> >   3 | TF  |        |        |   -1 |            1 |   3 |   1 |
> >   4 |   1 |
> >
> 0102000000020000000000000000000840000000000000F03F0000000000001040000000000000F03F
> >
> >   4 | B   |        |        |    1 |            1 |   2 |   1 |
> >   2 |   2 |
> >
> 0102000000020000000000000000000040000000000000F03F00000000000000400000000000000040
> >
> >   5 | FT  |        |        |    1 |           -1 |   3 |   1 |
> >   3 |   2 |
> >
> 0102000000020000000000000000000840000000000000F03F00000000000008400000000000000040
> >
> >   6 | B   |        |        |    1 |            1 |   0 |   2 |
> >   1 |   2 |
> >
> 01020000000200000000000000000000000000000000000040000000000000F03F0000000000000040
> >
> >   7 | B   |        |        |    1 |            1 |   1 |   2 |
> >   2 |   2 |
> >
> 010200000002000000000000000000F03F000000000000004000000000000000400000000000000040
> >
> >   8 | B   |        |        |    1 |            1 |   2 |   2 |
> >   3 |   2 |
> >
> 0102000000020000000000000000000040000000000000004000000000000008400000000000000040
> >
> >   9 | B   |        |        |    1 |            1 |   3 |   2 |
> >   4 |   2 |
> >
> 0102000000020000000000000000000840000000000000004000000000000010400000000000000040
> >
> >  10 | B   |        |        |    1 |            1 |   2 |   2 |
> >   2 |   3 |
> >
> 0102000000020000000000000000000040000000000000004000000000000000400000000000000840
> >
> >  11 | FT  |        |        |    1 |           -1 |   3 |   2 |
> >   3 |   3 |
> >
> 0102000000020000000000000000000840000000000000004000000000000008400000000000000840
> >
> >  12 | FT  |        |        |    1 |           -1 |   2 |   3 |
> >   3 |   3 |
> >
> 0102000000020000000000000000000040000000000000084000000000000008400000000000000840
> >
> >  13 | FT  |        |        |    1 |           -1 |   3 |   3 |
> >   4 |   3 |
> >
> 0102000000020000000000000000000840000000000000084000000000000010400000000000000840
> >
> >  14 | B   |        |        |    1 |            1 |   2 |   3 |
> >   2 |   4 |
> >
> 0102000000020000000000000000000040000000000000084000000000000000400000000000001040
> >
> >  15 | B   |        |        |    1 |            1 |   4 |   2 |
> >   4 |   3 |
> >
> 0102000000020000000000000000001040000000000000004000000000000010400000000000000840
> >
> >  16 | B   |        |        |    1 |            1 |   4 |   1 |
> >   4 |   2 |
> >
> 0102000000020000000000000000001040000000000000F03F00000000000010400000000000000040
> >
> >  17 | B   |        |        |    1 |            1 | 0.5 | 3.5 |
> > 1.999999999999 | 3.5 |
> >
> 010200000002000000000000000000E03F0000000000000C4068EEFFFFFFFFFF3F0000000000000C40
> >
> >  18 | B   |        |        |    1 |            1 | 3.5 | 2.3 |
> > 3.5 |   4 |
> >
> 0102000000020000000000000000000C4066666666666602400000000000000C400000000000001040
> >
> > (18 rows)
> >
> >
> >
> >
> >
> > pgr_sample=# select pgr_createTopology('edge_table', 0.001);
> >
> > NOTICE:  PROCESSING:
> >
> > NOTICE:  pgr_createTopology('edge_table', 0.001, 'the_geom', 'id',
> > 'source', 'target', rows_where := 'true', clean := f)
> >
> > NOTICE:  Performing checks, please wait .....
> >
> > NOTICE:  Creating Topology, Please wait...
> >
> > NOTICE:  -------------> TOPOLOGY CREATED FOR  18 edges
> >
> > NOTICE:  Rows with NULL geometry or NULL id: 0
> >
> > NOTICE:  Vertices table for table public.edge_table is:
> > public.edge_table_vertices_pgr
> >
> > NOTICE:  ----------------------------------------------
> >
> >  pgr_createtopology
> >
> > --------------------
> >
> >  OK
> >
> > (1 row)
> >
> >
> >
> >
> >
> > pgr_sample=# select pgr_analyzeGraph('edge_table', 0.001);
> >
> > NOTICE:  PROCESSING:
> >
> > NOTICE:
> >
> pgr_analyzeGraph('edge_table',0.001,'the_geom','id','source','target','true')
> >
> > NOTICE:  Performing checks, please wait ...
> >
> > NOTICE:  Analyzing for dead ends. Please wait...
> >
> > NOTICE:  Analyzing for gaps. Please wait...
> >
> > NOTICE:  Analyzing for isolated edges. Please wait...
> >
> > NOTICE:  Analyzing for ring geometries. Please wait...
> >
> > NOTICE:  Analyzing for intersections. Please wait...
> >
> > NOTICE:              ANALYSIS RESULTS FOR SELECTED EDGES:
> >
> > NOTICE:                    Isolated segments: 2
> >
> > NOTICE:                            Dead ends: 7
> >
> > NOTICE:  Potential gaps found near dead ends: 1
> >
> > NOTICE:               Intersections detected: 1
> >
> > NOTICE:                      Ring geometries: 0
> >
> >  pgr_analyzegraph
> >
> > ------------------
> >
> >  OK
> >
> > (1 row)
> >
> >
> >
> >
> >
> > pgr_sample=# select pgr_nodeNetwork('edge_table', 0.001);
> >
> > NOTICE:  PROCESSING:
> >
> > NOTICE:  pgr_nodeNetwork('edge_table', 0.001, 'id', 'the_geom', 'noded',
> > '<NULL>',  f)
> >
> > NOTICE:  Performing checks, please wait .....
> >
> > NOTICE:  Processing, please wait .....
> >
> > NOTICE:    Splitted Edges: 2
> >
> > NOTICE:   Untouched Edges: 16
> >
> > NOTICE:       Total original Edges: 18
> >
> > NOTICE:   Edges generated: 4
> >
> > NOTICE:   Untouched Edges: 16
> >
> > NOTICE:         Total New segments: 20
> >
> > NOTICE:   New Table: public.edge_table_noded
> >
> > NOTICE:  ----------------------------------
> >
> >  pgr_nodenetwork
> >
> > -----------------
> >
> >  OK
> >
> > (1 row)
> >
> >
> >
> >
> >
> > pgr_sample=# select pgr_createTopology('edge_table_noded', 0.001);
> >
> > NOTICE:  PROCESSING:
> >
> > NOTICE:  pgr_createTopology('edge_table_noded', 0.001, 'the_geom', 'id',
> > 'source', 'target', rows_where := 'true', clean := f)
> >
> > NOTICE:  Performing checks, please wait .....
> >
> > NOTICE:  Creating Topology, Please wait...
> >
> > NOTICE:  -------------> TOPOLOGY CREATED FOR  20 edges
> >
> > NOTICE:  Rows with NULL geometry or NULL id: 0
> >
> > NOTICE:  Vertices table for table public.edge_table_noded is:
> > public.edge_table_noded_vertices_pgr
> >
> > NOTICE:  ----------------------------------------------
> >
> >  pgr_createtopology
> >
> > --------------------
> >
> >  OK
> >
> > (1 row)
> >
> >
> >
> >
> >
> > pgr_sample=# select pgr_analyzeGraph('edge_table_noded', 0.001);
> >
> > NOTICE:  PROCESSING:
> >
> > NOTICE:
> >
> pgr_analyzeGraph('edge_table_noded',0.001,'the_geom','id','source','target','true')
> >
> > NOTICE:  Performing checks, please wait ...
> >
> > NOTICE:  Analyzing for dead ends. Please wait...
> >
> > NOTICE:  Analyzing for gaps. Please wait...
> >
> > NOTICE:  Analyzing for isolated edges. Please wait...
> >
> > NOTICE:  Analyzing for ring geometries. Please wait...
> >
> > NOTICE:  Analyzing for intersections. Please wait...
> >
> > NOTICE:              ANALYSIS RESULTS FOR SELECTED EDGES:
> >
> > NOTICE:                    Isolated segments: 1
> >
> > NOTICE:                            Dead ends: 7
> >
> > NOTICE:  Potential gaps found near dead ends: 1
> >
> > NOTICE:               Intersections detected: 0
> >
> > NOTICE:                      Ring geometries: 0
> >
> >  pgr_analyzegraph
> >
> > ------------------
> >
> >  OK
> >
> > (1 row)
> >
> >
> >
> >
> >
> > pgr_sample=# SELECT a.*
> >
> > pgr_sample-# FROM edge_table_noded a, edge_table_noded_vertices_pgr b,
> > edge_table_noded_vertices_pgr c
> >
> > pgr_sample-# WHERE a.source=b.id <http://b.id>  AND b.cnt=1 AND
> a.target=
> > c.id <http://c.id>  AND c.cnt=1;
> >
> >  id | old_id | sub_id | source | target |
> >     the_geom
> >
> >
> >
> ----+--------+--------+--------+--------+------------------------------------------------------------------------------------
> >
> >  20 |     17 |      1 |     17 |     18 |
> >
> 010200000002000000000000000000E03F0000000000000C4068EEFFFFFFFFFF3F0000000000000C40
> >
> > (1 row)
> >
> >
> >
> >
> >
> > So the original node id 17, which is a nearly touching T-intersection,
> > remains isolated. This is in contrast to the output shown in the manual,
> > which shows the following:
> >
> >
> >
> > SELECT pgr_analyzegraph('edge_table_noded', 0.001);
> > NOTICE:  PROCESSING:
> > NOTICE:
> >
> pgr_analyzeGraph('edge_table_noded',0.001,'the_geom','id','source','target','true')
> > NOTICE:  Performing checks, pelase wait...
> > NOTICE:  Analyzing for dead ends. Please wait...
> > NOTICE:  Analyzing for gaps. Please wait...
> > NOTICE:  Analyzing for isolated edges. Please wait...
> > NOTICE:  Analyzing for ring geometries. Please wait...
> > NOTICE:  Analyzing for intersections. Please wait...
> > NOTICE:              ANALYSIS RESULTS FOR SELECTED EDGES:
> > NOTICE:                    Isolated segments: 0
> > NOTICE:                            Dead ends: 6
> > NOTICE:  Potential gaps found near dead ends: 0
> > NOTICE:               Intersections detected: 0
> > NOTICE:                      Ring geometries: 0
> > pgr_createtopology
> > --------------------
> >  OK
> > (1 row)
> >
> > I tried the following but none helped:
> >
> > - increasing the value of tolerance up to 0.5
> >
> > - setting the SRID of the geometry column
> >
> > - converting data to .osm file and run osm2pgrouting
> >
> >
> >
> > I am using the following versions on Windows 10 64-bit PC:
> >
> >
> >
> > pgr_sample=# select version(), postgis_full_version(), pgr_version();
> >
> >                            version                           |
> >
> >  postgis_full_version
> >
> >                                                         |
> > pgr_version
> >
> >
> >
> -------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------
> >
> >
> >
> --------------------------------------------------------+-----------------------------------------------
> >
> >  PostgreSQL 9.5.2, compiled by Visual C++ build 1800, 64-bit |
> > POSTGIS="2.2.2 r14797" GEOS="3.5.0-CAPI-1.9.0 r4090" PROJ="Rel. 4.9.1, 04
> > March 2015" GDAL="GDAL 2.0.2, re
> >
> > leased 2016/01/26" LIBXML="2.7.8" LIBJSON="0.12" RASTER |
> > (2.2.0,pgrouting-2.2.0,afc622e,master,1.59.0)
> >
> > (1 row)
> >
> >
> >
> > Thanks in advance for your help!
> >
> >
> >
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: <
> >
> http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20160514/0d095906/attachment.html
> > >
> >
> > ------------------------------
> >
> > Subject: Digest Footer
> >
> > _______________________________________________
> > Pgrouting-users mailing list
> > Pgrouting-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/pgrouting-users
> >
> > ------------------------------
> >
> > End of Pgrouting-users Digest, Vol 92, Issue 2
> > **********************************************
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20160514/6ef9660c/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>
> ------------------------------
>
> End of Pgrouting-users Digest, Vol 92, Issue 3
> **********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20160514/7e80d8cc/attachment-0001.html>


More information about the Pgrouting-users mailing list