[pgrouting-users] Problem with topology using sample data in the manual

Regina Obe lr at pcorp.us
Fri May 13 21:24:18 PDT 2016


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-0001.html>


More information about the Pgrouting-users mailing list