[pgrouting-users] osm_relations table does not get populated

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

haywards-heath-uk-small-extract.osm (1.13 MB)

Hello,

I can not reproduce your problem:

What is needed:

  1. The exact data that has been used, can be in the form of a link to a shared file, the wget command to download from osm.

  2. the exact command that is been used (use mylogin and mypass instead of the real ones when posting the command)

Regards
Vicky

On Fri, Jun 2, 2023 at 3:52 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

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

Hello Vicky and thanks for your response,

Maybe due to formatting issues the data and the command were not visible.

  1. Data: https://github.com/pgRouting/osm2pgrouting/files/11598959/haywards-heath-uk-small-extract.txt
  2. Exact command: osm2pgrouting -f home/map.osm -c “/usr/local/share/osm2pgrouting/mapconfig.xml” -d city_routing -U [username] -W [password] --clean --tags --addnodes

On Fri, Jun 2, 2023 at 6:25 PM Vicky Vergara <vicky@erosion.dev> wrote:

Hello,

I can not reproduce your problem:

What is needed:

  1. The exact data that has been used, can be in the form of a link to a shared file, the wget command to download from osm.

  2. the exact command that is been used (use mylogin and mypass instead of the real ones when posting the command)

Regards
Vicky

On Fri, Jun 2, 2023 at 3:52 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

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


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

Hello,

In the data file you’ve provided, named ‘haywards-heath-uk-small-extract.txt’,
there are 8 OpenStreetMap (OSM) relation objects [2]
that are marked as either ‘boundary=*’ or ‘landuse=residential’.
It appears that none of these are related to routes or are included in the ‘mapconfig.xml’ [1] file.

Could you please specify which OSM relation you’re missing from your table?

Could you also test it with another input data set? Specifically, one that includes a ‘highway=*’ osm relation in the extract.

[1] https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig.xml
[2] osmium cat haywards-heath-uk-small-extract.osm.xml -t relation -f opl | cut -d’ ’ -f8
[3] https://taginfo.openstreetmap.org/keys/highway#overview

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 3., Szo, 19:11):

Hello Vicky and thanks for your response,

Maybe due to formatting issues the data and the command were not visible.

  1. Data: https://github.com/pgRouting/osm2pgrouting/files/11598959/haywards-heath-uk-small-extract.txt
  2. Exact command: osm2pgrouting -f home/map.osm -c “/usr/local/share/osm2pgrouting/mapconfig.xml” -d city_routing -U [username] -W [password] --clean --tags --addnodes

On Fri, Jun 2, 2023 at 6:25 PM Vicky Vergara <vicky@erosion.dev> wrote:

Hello,

I can not reproduce your problem:

What is needed:

  1. The exact data that has been used, can be in the form of a link to a shared file, the wget command to download from osm.

  2. the exact command that is been used (use mylogin and mypass instead of the real ones when posting the command)

Regards
Vicky

On Fri, Jun 2, 2023 at 3:52 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

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


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


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

Hello Imre,

Thanks for your comment.

I will test with another data set.

Meanwhile, may I ask:

  1. It seems that by default osm2pgrouting will only store those osm_relations that are related to routes and that contain “highway”-tagged ways, is this correct?
  2. Is it possible to edit mapconfig.xml to include other, non-highway relations?

Thank you.

On Sun, Jun 4, 2023 at 4:21 PM Imre Samu <pella.samu@gmail.com> wrote:

Hello,

In the data file you’ve provided, named ‘haywards-heath-uk-small-extract.txt’,
there are 8 OpenStreetMap (OSM) relation objects [2]
that are marked as either ‘boundary=*’ or ‘landuse=residential’.
It appears that none of these are related to routes or are included in the ‘mapconfig.xml’ [1] file.

Could you please specify which OSM relation you’re missing from your table?

Could you also test it with another input data set? Specifically, one that includes a ‘highway=*’ osm relation in the extract.

[1] https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig.xml
[2] osmium cat haywards-heath-uk-small-extract.osm.xml -t relation -f opl | cut -d’ ’ -f8
[3] https://taginfo.openstreetmap.org/keys/highway#overview

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 3., Szo, 19:11):

Hello Vicky and thanks for your response,

Maybe due to formatting issues the data and the command were not visible.

  1. Data: https://github.com/pgRouting/osm2pgrouting/files/11598959/haywards-heath-uk-small-extract.txt
  2. Exact command: osm2pgrouting -f home/map.osm -c “/usr/local/share/osm2pgrouting/mapconfig.xml” -d city_routing -U [username] -W [password] --clean --tags --addnodes

On Fri, Jun 2, 2023 at 6:25 PM Vicky Vergara <vicky@erosion.dev> wrote:

Hello,

I can not reproduce your problem:

What is needed:

  1. The exact data that has been used, can be in the form of a link to a shared file, the wget command to download from osm.

  2. the exact command that is been used (use mylogin and mypass instead of the real ones when posting the command)

Regards
Vicky

On Fri, Jun 2, 2023 at 3:52 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

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


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


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


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

Another input dataset:

Attaching another .osm extract (please rename from .txt). This file contains at least one highway (“Sydney Road”) which is a part of a route relation (“270 Brighton - East Grinstead”).

This highway has a tag highway=secondary which is declared in mapconfig.xml.

On Mon, Jun 5, 2023 at 11:17 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Hello Imre,

Thanks for your comment.

I will test with another data set.

Meanwhile, may I ask:

  1. It seems that by default osm2pgrouting will only store those osm_relations that are related to routes and that contain “highway”-tagged ways, is this correct?
  2. Is it possible to edit mapconfig.xml to include other, non-highway relations?

Thank you.

On Sun, Jun 4, 2023 at 4:21 PM Imre Samu <pella.samu@gmail.com> wrote:

Hello,

In the data file you’ve provided, named ‘haywards-heath-uk-small-extract.txt’,
there are 8 OpenStreetMap (OSM) relation objects [2]
that are marked as either ‘boundary=*’ or ‘landuse=residential’.
It appears that none of these are related to routes or are included in the ‘mapconfig.xml’ [1] file.

Could you please specify which OSM relation you’re missing from your table?

Could you also test it with another input data set? Specifically, one that includes a ‘highway=*’ osm relation in the extract.

[1] https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig.xml
[2] osmium cat haywards-heath-uk-small-extract.osm.xml -t relation -f opl | cut -d’ ’ -f8
[3] https://taginfo.openstreetmap.org/keys/highway#overview

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 3., Szo, 19:11):

Hello Vicky and thanks for your response,

Maybe due to formatting issues the data and the command were not visible.

  1. Data: https://github.com/pgRouting/osm2pgrouting/files/11598959/haywards-heath-uk-small-extract.txt
  2. Exact command: osm2pgrouting -f home/map.osm -c “/usr/local/share/osm2pgrouting/mapconfig.xml” -d city_routing -U [username] -W [password] --clean --tags --addnodes

On Fri, Jun 2, 2023 at 6:25 PM Vicky Vergara <vicky@erosion.dev> wrote:

Hello,

I can not reproduce your problem:

What is needed:

  1. The exact data that has been used, can be in the form of a link to a shared file, the wget command to download from osm.

  2. the exact command that is been used (use mylogin and mypass instead of the real ones when posting the command)

Regards
Vicky

On Fri, Jun 2, 2023 at 3:52 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

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


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


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


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

haywards-heath-uk-small-extract-routes.osm.txt (615 KB)

  1. It seems that by default osm2pgrouting will only store those osm_relations that are related to routes and that contain “highway”-tagged ways, is this correct?

In my opinion, yes. (But please note that I’m just a user.)

  1. Is it possible to edit mapconfig.xml to include other, non-highway relations?

check the https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig_for_bicycles.xml

  • cycleway
  • cycleway:right
  • cycleway:left
  • tracktype
  • highway

If you want to include non-route related data, such as Points of Interest (POIs), borders, and so on, I recommend using https://osm2pgsql.org/.
This tool can also be a useful way to verify the functioning of the osm2pgrouting program.

If you’re finding that a route is present in the osm2pgsql tables but not in the osm2pgrouting ones, it’s likely that you need to adjust the configuration.
There can be a wide variety of ‘highway=’ values, as OSM editors can use any key-value pair.
You can see a list of these values at https://taginfo.openstreetmap.org/keys/highway#values.

Sometimes, an extract might not contain all parts of an extremely long relation, which means it won’t be imported.
In such cases, osm2pgsql also won’t import it. This situation can help you identify potential data issues.

Be aware that there’s a known issue with osm2pgrouting ;
If you’re using it, consider increasing the value of the “–chunk” parameter. ( --chunk 10000000 )
https://github.com/pgRouting/osm2pgrouting/issues/296

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 5., H, 11:20):

Hello Imre,

Thanks for your comment.

I will test with another data set.

Meanwhile, may I ask:

  1. It seems that by default osm2pgrouting will only store those osm_relations that are related to routes and that contain “highway”-tagged ways, is this correct?
  2. Is it possible to edit mapconfig.xml to include other, non-highway relations?

Thank you.

On Sun, Jun 4, 2023 at 4:21 PM Imre Samu <pella.samu@gmail.com> wrote:

Hello,

In the data file you’ve provided, named ‘haywards-heath-uk-small-extract.txt’,
there are 8 OpenStreetMap (OSM) relation objects [2]
that are marked as either ‘boundary=*’ or ‘landuse=residential’.
It appears that none of these are related to routes or are included in the ‘mapconfig.xml’ [1] file.

Could you please specify which OSM relation you’re missing from your table?

Could you also test it with another input data set? Specifically, one that includes a ‘highway=*’ osm relation in the extract.

[1] https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig.xml
[2] osmium cat haywards-heath-uk-small-extract.osm.xml -t relation -f opl | cut -d’ ’ -f8
[3] https://taginfo.openstreetmap.org/keys/highway#overview

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 3., Szo, 19:11):

Hello Vicky and thanks for your response,

Maybe due to formatting issues the data and the command were not visible.

  1. Data: https://github.com/pgRouting/osm2pgrouting/files/11598959/haywards-heath-uk-small-extract.txt
  2. Exact command: osm2pgrouting -f home/map.osm -c “/usr/local/share/osm2pgrouting/mapconfig.xml” -d city_routing -U [username] -W [password] --clean --tags --addnodes

On Fri, Jun 2, 2023 at 6:25 PM Vicky Vergara <vicky@erosion.dev> wrote:

Hello,

I can not reproduce your problem:

What is needed:

  1. The exact data that has been used, can be in the form of a link to a shared file, the wget command to download from osm.

  2. the exact command that is been used (use mylogin and mypass instead of the real ones when posting the command)

Regards
Vicky

On Fri, Jun 2, 2023 at 3:52 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

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


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


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


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


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

1 Like

Attaching another .osm extract (please rename from .txt).

Sometimes, an extract might not contain all parts of an extremely long relation, which means it won’t be imported.

You can use “osmium check-refs” to check referential integrity of OSM file.
https://docs.osmcode.org/osmium/latest/osmium-check-refs.html

osmium check-refs -r haywards-heath-uk-small-extract-routes.osm.xml
[======================================================================] 100%
There are 1969 nodes, 197 ways, and 14 relations in this file.
Nodes in ways missing: 0
Nodes in relations missing: 297 <---- !!!
Ways in relations missing: 870 <---- !!!
Relations in relations missing: 0

This file contains at least one highway (“Sydney Road”) which is a part of a route relation (“270 Brighton - East Grinstead”).

( adding: “-i, --show-ids” ) you can check the missing ids.
osmium check-refs -i -r haywards-heath-uk-small-extract-routes.osm.xml

missing ways in https://www.openstreetmap.org/relation/11566101


w20863252 in r11566101

w1124142166 in r11566101
w1124142167 in r11566101
w159596938 in r11566101
w181594063 in r11566101

missing ways in https://www.openstreetmap.org/relation/11566102

w14396123 in r11566102
w153899205 in r11566102
w223616400 in r11566102
w145426967 in r11566102

And you can check your example: “270 Brighton → East Grinstead”
https://www.openstreetmap.org/relation/11561226

osmium check-refs -i -r haywards-heath-uk-small-extract-routes.osm.xml | grep r11561226

w960935109 in r11561226
w954035172 in r11561226
w954241918 in r11561226
w3807763 in r11561226
w843923122 in r11561226
w964331211 in r11561226
w986987784 in r11561226
w3995557 in r11561226
w986987785 in r11561226
w165441577 in r11561226
w4378508 in r11561226
w137403281 in r11561226
w137403098 in r11561226
w638278559 in r11561226
w719574502 in r11561226
w793744330 in r11561226

Attaching another .osm extract

imho :

if you are using osmium extract [2] probably you have to use the “Strategy: smart” to extract osm data.
"When using the smart strategy, everything is done as in the complete_ways strategy, but multipolygon relations that have at least one node in the region will also be completely included. You can see this in the example image: If a multipolygon relation ties the red, green, and blue ways together, the blue way and all its nodes will be included.
…**" [1]

[1] https://osmcode.org/osmium-tool/manual.html#creating-geographic-extracts
[2] https://docs.osmcode.org/osmium/latest/osmium-extract.html

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 5., H, 12:11):

Another input dataset:

Attaching another .osm extract (please rename from .txt). This file contains at least one highway (“Sydney Road”) which is a part of a route relation (“270 Brighton - East Grinstead”).

This highway has a tag highway=secondary which is declared in mapconfig.xml.

On Mon, Jun 5, 2023 at 11:17 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Hello Imre,

Thanks for your comment.

I will test with another data set.

Meanwhile, may I ask:

  1. It seems that by default osm2pgrouting will only store those osm_relations that are related to routes and that contain “highway”-tagged ways, is this correct?
  2. Is it possible to edit mapconfig.xml to include other, non-highway relations?

Thank you.

On Sun, Jun 4, 2023 at 4:21 PM Imre Samu <pella.samu@gmail.com> wrote:

Hello,

In the data file you’ve provided, named ‘haywards-heath-uk-small-extract.txt’,
there are 8 OpenStreetMap (OSM) relation objects [2]
that are marked as either ‘boundary=*’ or ‘landuse=residential’.
It appears that none of these are related to routes or are included in the ‘mapconfig.xml’ [1] file.

Could you please specify which OSM relation you’re missing from your table?

Could you also test it with another input data set? Specifically, one that includes a ‘highway=*’ osm relation in the extract.

[1] https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig.xml
[2] osmium cat haywards-heath-uk-small-extract.osm.xml -t relation -f opl | cut -d’ ’ -f8
[3] https://taginfo.openstreetmap.org/keys/highway#overview

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 3., Szo, 19:11):

Hello Vicky and thanks for your response,

Maybe due to formatting issues the data and the command were not visible.

  1. Data: https://github.com/pgRouting/osm2pgrouting/files/11598959/haywards-heath-uk-small-extract.txt
  2. Exact command: osm2pgrouting -f home/map.osm -c “/usr/local/share/osm2pgrouting/mapconfig.xml” -d city_routing -U [username] -W [password] --clean --tags --addnodes

On Fri, Jun 2, 2023 at 6:25 PM Vicky Vergara <vicky@erosion.dev> wrote:

Hello,

I can not reproduce your problem:

What is needed:

  1. The exact data that has been used, can be in the form of a link to a shared file, the wget command to download from osm.

  2. the exact command that is been used (use mylogin and mypass instead of the real ones when posting the command)

Regards
Vicky

On Fri, Jun 2, 2023 at 3:52 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

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


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


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


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


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

Hi Tokura San:

Yes it is possible, you have to make your own.

There is are 2 examples here:

https://workshop.pgrouting.org/2.8/en/un_sdg/data.html#appendix

One is incorporating buildings the other one incorporates waterways
Regards
Vicky

On Mon, Jun 5, 2023 at 4:45 AM Imre Samu <pella.samu@gmail.com> wrote:

  1. It seems that by default osm2pgrouting will only store those osm_relations that are related to routes and that contain “highway”-tagged ways, is this correct?

In my opinion, yes. (But please note that I’m just a user.)

  1. Is it possible to edit mapconfig.xml to include other, non-highway relations?

check the https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig_for_bicycles.xml

  • cycleway
  • cycleway:right
  • cycleway:left
  • tracktype
  • highway

If you want to include non-route related data, such as Points of Interest (POIs), borders, and so on, I recommend using https://osm2pgsql.org/.
This tool can also be a useful way to verify the functioning of the osm2pgrouting program.

If you’re finding that a route is present in the osm2pgsql tables but not in the osm2pgrouting ones, it’s likely that you need to adjust the configuration.
There can be a wide variety of ‘highway=’ values, as OSM editors can use any key-value pair.
You can see a list of these values at https://taginfo.openstreetmap.org/keys/highway#values.

Sometimes, an extract might not contain all parts of an extremely long relation, which means it won’t be imported.
In such cases, osm2pgsql also won’t import it. This situation can help you identify potential data issues.

Be aware that there’s a known issue with osm2pgrouting ;
If you’re using it, consider increasing the value of the “–chunk” parameter. ( --chunk 10000000 )
https://github.com/pgRouting/osm2pgrouting/issues/296

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 5., H, 11:20):

Hello Imre,

Thanks for your comment.

I will test with another data set.

Meanwhile, may I ask:

  1. It seems that by default osm2pgrouting will only store those osm_relations that are related to routes and that contain “highway”-tagged ways, is this correct?
  2. Is it possible to edit mapconfig.xml to include other, non-highway relations?

Thank you.

On Sun, Jun 4, 2023 at 4:21 PM Imre Samu <pella.samu@gmail.com> wrote:

Hello,

In the data file you’ve provided, named ‘haywards-heath-uk-small-extract.txt’,
there are 8 OpenStreetMap (OSM) relation objects [2]
that are marked as either ‘boundary=*’ or ‘landuse=residential’.
It appears that none of these are related to routes or are included in the ‘mapconfig.xml’ [1] file.

Could you please specify which OSM relation you’re missing from your table?

Could you also test it with another input data set? Specifically, one that includes a ‘highway=*’ osm relation in the extract.

[1] https://github.com/pgRouting/osm2pgrouting/blob/main/mapconfig.xml
[2] osmium cat haywards-heath-uk-small-extract.osm.xml -t relation -f opl | cut -d’ ’ -f8
[3] https://taginfo.openstreetmap.org/keys/highway#overview

Regards,
Imre

Tokura Gou <tokura.gou@gmail.com> ezt írta (időpont: 2023. jún. 3., Szo, 19:11):

Hello Vicky and thanks for your response,

Maybe due to formatting issues the data and the command were not visible.

  1. Data: https://github.com/pgRouting/osm2pgrouting/files/11598959/haywards-heath-uk-small-extract.txt
  2. Exact command: osm2pgrouting -f home/map.osm -c “/usr/local/share/osm2pgrouting/mapconfig.xml” -d city_routing -U [username] -W [password] --clean --tags --addnodes

On Fri, Jun 2, 2023 at 6:25 PM Vicky Vergara <vicky@erosion.dev> wrote:

Hello,

I can not reproduce your problem:

What is needed:

  1. The exact data that has been used, can be in the form of a link to a shared file, the wget command to download from osm.

  2. the exact command that is been used (use mylogin and mypass instead of the real ones when posting the command)

Regards
Vicky

On Fri, Jun 2, 2023 at 3:52 AM Tokura Gou <tokura.gou@gmail.com> wrote:

Problem

When running osm2pgrouting on a typical .osm file with the --addnodes option, osm_relations table stays empty.

To Reproduce

osm2pgrouting -f home/map.osm -c "/usr/local/share/osm2pgrouting/mapconfig.xml" -d city_routing -U [username] -W [password] --clean --tags --addnodes

Expectation

I use the --addnodes flag as per the documentation and I can see that osm_nodes and osm_ways tables do get populated. However, osm_relations has 0 records after running osm2pgrouting and “Final osm_relations:” is never mentioned in the output:

Creating tables...
TABLE: ways_vertices_pgr created ... OK.
TABLE: ways created ... OK.
TABLE: pointsofinterest created ... OK.
TABLE: configuration created ... OK.
TABLE: osm_nodes created ... OK.
TABLE: osm_ways created ... OK.
TABLE: osm_relations created ... OK.
Opening configuration file: /usr/local/share/osm2pgrouting/mapconfig.xml
    Parsing configuration

Exporting configuration ...
  - Done
Counting lines ...
  - Done
Opening data file: home/map.osm  total lines: 175957
    Parsing data

Current osm_nodes:      48000
Final osm_nodes:        48375
Current osm_ways:       6000
Final osm_ways:         6320

...

End Of file

    Finish Parsing data

Adding auxiliary tables to database...

Export Ways ...

...

Creating indexes ...

Processing Points of Interest ...

Adding functions for processing Points of Interest ...

To process pointsOfInterest table:
osm2pgr_pois_update(radius default 200, within default 50)

  - Using areas of (radius)mts on POIS
  - Using edges that are at least (within) mts of each POI
POIS that do not have a closest edge is considered as too far
#########################
size of streets: 6320
Execution started at: Tue May 30 10:07:09 2023
Execution ended at:   Tue May 30 10:07:21 2023
Elapsed time: 11.767 Seconds.
User CPU time: -> 1.12268 seconds

Sample Data

A sample .osm file is attached (please rename from txt to osm if needed), however I have tried other .osm exports that contain osm relations with the same result.

haywards-heath-uk-small-extract.txt

Platform/versions

SELECT version();

PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

SELECT postgis_full_version();

POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.9.0-CAPI-1.16.2" PROJ="7.2.1" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"

SELECT pgr_version();

3.4.1

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


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


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


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


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


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