[pgrouting-users] pgr_nodenetwork

Hello,

I have been trying to make some sense of the function pgr_nodenetwork, but I haven’t succeeded.

Based on the documentation, this function “Nodes an network edge table.(…). What we mean by “noded” is that at every intersection in the road network all the edges will be broken into separate road segments”

I have been doing tests for the last couple of days. You can reproduce a simple one, by executing the following SQL statements.

– Create test_graph table and insert two geometries

SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE “test_graph” (gid serial,
“id” numeric(10,0),
“nom” varchar(80));
ALTER TABLE “test_graph” ADD PRIMARY KEY (gid);
SELECT AddGeometryColumn(‘’,‘test_graph’,‘geom’,‘25831’,‘LINESTRING’,2);
INSERT INTO “test_graph” (“id”,“nom”,geom) VALUES (‘3’,NULL,‘0102000020E764000008000000F281433F6B731A41C84583B869855141592275DD14731A41C89C7A7D73855141B3E5D70CD3721A4164B5681680855141BFC2A67BBE721A419A3856BE8585514137F861B0A1721A41D72C1EC58F855141D87C445995721A413DC21EB6968551416D2458939D721A41DFF4EFE89D85514137F861B0A1721A411578DD90A3855141’);
INSERT INTO “test_graph” (“id”,“nom”,geom) VALUES (‘5’,NULL,‘0102000020E76400000900000065D6DA5A51701A410D5914A88B855141DA9E3C70E5701A4106E8394987855141ADE2BBDC85711A415E9B857C85855141C32F009B0D721A416B2643758485514150B2FF8D78721A41A8C313B784855141BFC2A67BBE721A419A3856BE85855141930626E85E731A4135FA4C92888551414E90077728741A418D04908A90855141A5E6108797741A41F399907B97855141’);
COMMIT;
ANALYZE “test_graph”;

– Try to node the network.
select pgr_nodenetwork (‘test_Graph’, 0.01, ‘gid’, ‘geom’);

You can see the geometries on images, before (http://sigserver4.udg.edu/apps/original_geometries.png) and after (http://sigserver4.udg.edu/apps/noded_geometries.png), the noding proces.

The result, is a set of 6 rows but the segments generated are not the expected ones.

Does anyone know what’s happening here?

Thanks for your help.

···


Toni Hernández Vallès
Servei de Sistemes d’Informació Geogràfica i Teledetecció

Universitat de Girona
SIGTE

Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
toni.hernandez@udg.edu

http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG

Thank you for reporting the issue and the easy to reproduce test case!

I tried with a different projection, but the issue remained.
I think, it’s better to track this in the pgRouting Github repository, so I created the following issue: https://github.com/pgRouting/pgrouting/issues/1009

Best regards,
Daniel

···

On Fri, Mar 16, 2018 at 12:03 AM, Toni Hérnández <toni.hernandez@udg.edu> wrote:

Hello,

I have been trying to make some sense of the function pgr_nodenetwork, but I haven’t succeeded.

Based on the documentation, this function “Nodes an network edge table.(…). What we mean by “noded” is that at every intersection in the road network all the edges will be broken into separate road segments”

I have been doing tests for the last couple of days. You can reproduce a simple one, by executing the following SQL statements.

– Create test_graph table and insert two geometries

SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE “test_graph” (gid serial,
“id” numeric(10,0),
“nom” varchar(80));
ALTER TABLE “test_graph” ADD PRIMARY KEY (gid);
SELECT AddGeometryColumn(‘’,‘test_graph’,‘geom’,‘25831’,‘LINESTRING’,2);
INSERT INTO “test_graph” (“id”,“nom”,geom) VALUES (‘3’,NULL,‘0102000020E764000008000000F281433F6B731A41C84583B869855141592275DD14731A41C89C7A7D73855141B3E5D70CD3721A4164B5681680855141BFC2A67BBE721A419A3856BE8585514137F861B0A1721A41D72C1EC58F855141D87C445995721A413DC21EB6968551416D2458939D721A41DFF4EFE89D85514137F861B0A1721A411578DD90A3855141’);
INSERT INTO “test_graph” (“id”,“nom”,geom) VALUES (‘5’,NULL,‘0102000020E76400000900000065D6DA5A51701A410D5914A88B855141DA9E3C70E5701A4106E8394987855141ADE2BBDC85711A415E9B857C85855141C32F009B0D721A416B2643758485514150B2FF8D78721A41A8C313B784855141BFC2A67BBE721A419A3856BE85855141930626E85E731A4135FA4C92888551414E90077728741A418D04908A90855141A5E6108797741A41F399907B97855141’);
COMMIT;
ANALYZE “test_graph”;

– Try to node the network.
select pgr_nodenetwork (‘test_Graph’, 0.01, ‘gid’, ‘geom’);

You can see the geometries on images, before (http://sigserver4.udg.edu/apps/original_geometries.png) and after (http://sigserver4.udg.edu/apps/noded_geometries.png), the noding proces.

The result, is a set of 6 rows but the segments generated are not the expected ones.

Does anyone know what’s happening here?

Thanks for your help.


Toni Hernández Vallès
Servei de Sistemes d’Informació Geogràfica i Teledetecció

Universitat de Girona
SIGTE

Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
toni.hernandez@udg.edu

http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/pgrouting-users

Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: https://georepublic.info

Maybe It would be a good idea to use the idiosyncrasy of the function St_Union() . St_Union merges all geometries of a table but it also re-structures the merged geometry in a way, that it is possible to obtain all the segments based on the intersection points of the previous geometries.

Using the test_graph table of the example we can obtain the 4 segments combining st_dump with st_union.

select (st_dump(st_union(geom))).geom from test_graph

···

Toni Hernández Vallès
Servei de Sistemes d’Informació Geogràfica i Teledetecció

Universitat de Girona
SIGTE

Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
toni.hernandez@udg.edu

http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG

El 16/03/2018 a les 04:24, Daniel Kastl ha escrit:

Thank you for reporting the issue and the easy to reproduce test case!

I tried with a different projection, but the issue remained.
I think, it’s better to track this in the pgRouting Github repository, so I created the following issue: https://github.com/pgRouting/pgrouting/issues/1009

Best regards,
Daniel

On Fri, Mar 16, 2018 at 12:03 AM, Toni Hérnández <toni.hernandez@udg.edu> wrote:

Hello,

I have been trying to make some sense of the function pgr_nodenetwork, but I haven’t succeeded.

Based on the documentation, this function “Nodes an network edge table.(…). What we mean by “noded” is that at every intersection in the road network all the edges will be broken into separate road segments”

I have been doing tests for the last couple of days. You can reproduce a simple one, by executing the following SQL statements.

– Create test_graph table and insert two geometries

SET CLIENT_ENCODING TO UTF8;
SET STANDARD_CONFORMING_STRINGS TO ON;
BEGIN;
CREATE TABLE “test_graph” (gid serial,
“id” numeric(10,0),
“nom” varchar(80));
ALTER TABLE “test_graph” ADD PRIMARY KEY (gid);
SELECT AddGeometryColumn(‘’,‘test_graph’,‘geom’,‘25831’,‘LINESTRING’,2);
INSERT INTO “test_graph” (“id”,“nom”,geom) VALUES (‘3’,NULL,‘0102000020E764000008000000F281433F6B731A41C84583B869855141592275DD14731A41C89C7A7D73855141B3E5D70CD3721A4164B5681680855141BFC2A67BBE721A419A3856BE8585514137F861B0A1721A41D72C1EC58F855141D87C445995721A413DC21EB6968551416D2458939D721A41DFF4EFE89D85514137F861B0A1721A411578DD90A3855141’);
INSERT INTO “test_graph” (“id”,“nom”,geom) VALUES (‘5’,NULL,‘0102000020E76400000900000065D6DA5A51701A410D5914A88B855141DA9E3C70E5701A4106E8394987855141ADE2BBDC85711A415E9B857C85855141C32F009B0D721A416B2643758485514150B2FF8D78721A41A8C313B784855141BFC2A67BBE721A419A3856BE85855141930626E85E731A4135FA4C92888551414E90077728741A418D04908A90855141A5E6108797741A41F399907B97855141’);
COMMIT;
ANALYZE “test_graph”;

– Try to node the network.
select pgr_nodenetwork (‘test_Graph’, 0.01, ‘gid’, ‘geom’);

You can see the geometries on images, before (http://sigserver4.udg.edu/apps/original_geometries.png) and after (http://sigserver4.udg.edu/apps/noded_geometries.png), the noding proces.

The result, is a set of 6 rows but the segments generated are not the expected ones.

Does anyone know what’s happening here?

Thanks for your help.


Toni Hernández Vallès
Servei de Sistemes d’Informació Geogràfica i Teledetecció

Universitat de Girona
SIGTE

Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
toni.hernandez@udg.edu

http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/pgrouting-users

Georepublic UG & Georepublic Japan
eMail: daniel.kastl@georepublic.de
Web: https://georepublic.info

_______________________________________________
Pgrouting-users mailing list
[Pgrouting-users@lists.osgeo.org](mailto:Pgrouting-users@lists.osgeo.org)
[https://lists.osgeo.org/mailman/listinfo/pgrouting-users](https://lists.osgeo.org/mailman/listinfo/pgrouting-users)