{"id":13575674,"url":"https://github.com/pgRouting/osm2pgrouting","last_synced_at":"2025-04-04T22:31:45.820Z","repository":{"id":1152518,"uuid":"1037362","full_name":"pgRouting/osm2pgrouting","owner":"pgRouting","description":"Import tool for OpenStreetMap data to pgRouting database","archived":false,"fork":false,"pushed_at":"2024-10-16T14:10:09.000Z","size":2292,"stargazers_count":293,"open_issues_count":80,"forks_count":110,"subscribers_count":38,"default_branch":"main","last_synced_at":"2024-10-29T18:49:04.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pgrouting.org","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgRouting.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null},"funding":{"community_bridge":"pgrouting","open_collective":"pgrouting"}},"created_at":"2010-10-30T12:53:52.000Z","updated_at":"2024-10-16T14:10:15.000Z","dependencies_parsed_at":"2024-11-05T21:15:34.290Z","dependency_job_id":null,"html_url":"https://github.com/pgRouting/osm2pgrouting","commit_stats":{"total_commits":499,"total_committers":38,"mean_commits":"13.131578947368421","dds":0.5711422845691383,"last_synced_commit":"2e8364952b808e5fd16a826d991ba1667c1321dc"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgRouting%2Fosm2pgrouting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgRouting%2Fosm2pgrouting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgRouting%2Fosm2pgrouting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgRouting%2Fosm2pgrouting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgRouting","download_url":"https://codeload.github.com/pgRouting/osm2pgrouting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246604616,"owners_count":20804100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:01:03.192Z","updated_at":"2025-04-04T22:31:40.806Z","avatar_url":"https://github.com/pgRouting.png","language":"C++","funding_links":["https://funding.communitybridge.org/projects/pgrouting","https://opencollective.com/pgrouting"],"categories":["C++"],"sub_categories":[],"readme":"# osm2pgrouting\n\n[![Join the chat at https://gitter.im/pgRouting/osm2pgrouting](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pgRouting/osm2pgrouting?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n# Table of Contents\n\n* [Requirements](#requirements)\n* [Documentation](#documentation)\n* [Installation](#installation)\n* [How to use](#how-to-use)\n* [Tips](#tips)\n\n\n## Requirements\n\nBefore you can use this tool for importing Openstreetmap data you need to install:\n\n1. postgresql\n2. postgis\n3. pgrouting\n4. boost\n5. expat\n5. libpqxx\n6. cmake\n\nand to prepare a database.\n\n## Documentation\n\nSee in the documentation of the pgrouting website for more information: http://pgrouting.org\n\n## Installation\n\nFor compiling this tool, you will need boost, libpqxx, expat and cmake:\nThen just type the following in the root directory:\n\n```\ncmake -H. -Bbuild\ncd build/\nmake\nmake install\n```\n\nInstall some prerequisites:\n\n```\nsudo apt-get install expat\nsudo apt-get install libexpat1-dev\nsudo apt-get install libboost-dev\nsudo apt-get install libboost-program-options-dev\nsudo apt install libpqxx-dev\n```\n\n**Note:** FindLibPQXX.cmake does not find the version of libpqxx, but its documentation says C++11 is needed for the latests versions.\n\n\nIf you have libraries installed in non-standard locations, you might need to pass in parameters to cmake. Commonly useful parameters are\n\nCMAKE options:\n\n    -DBOOST_ROOT:PATH=/path/to/boost  folder that contains include, lib, bin directories for boost\n\n    -DEXPATH_INCLUDE_DIR:PATH=/path/to/expat/include  the include folder for where your expat is installed\n\n    -DPOSTGRESQL_INCLUDE_DIR:PATH=/path/to/postgresql/include  the include folder for postgresql development headers\n\n\nA cmake with custom options might look something like\n\n```\ncmake -DBOOST_ROOT:PATH=/local/projects/rel-boost-1.58.0 \\\n    -DPOSTGRESQL_INCLUDE_DIR:PATH=/local/projects/rel-pg94/include  -Bbuild\n```\n\n## How to use\n\nPrepare the database:\n\n```\ncreatedb routing\npsql --dbname routing -c 'CREATE EXTENSION postgis'\npsql --dbname routing -c 'CREATE EXTENSION pgRouting'\n```\n\nStart the program like this:\n\n```\nosm2pgrouting --f your-OSM-XML-File.osm --conf mapconfig.xml --dbname routing --username postgres --clean\n```\n\nDo incremental adition of data without using --clean\n\n```\nosm2pgrouting --f next-OSM-XML-File.osm --conf mapconfig.xml --dbname routing --username postgres\n```\n\n\nA complete list of arguments are:\n\n```\n osm2pgrouting --help\nAllowed options:\n\nHelp:\n  --help                Produce help message for this version.\n  -v [ --version ]      Print version string\n\nGeneral:\n  -f [ --file ] arg                     REQUIRED: Name of the osm file.\n  -c [ --conf ] arg (=/usr/share/osm2pgrouting/mapconfig.xml)\n                                        Name of the configuration xml file.\n  --schema arg                          Database schema to put tables.\n                                          blank: defaults to default schema\n                                                dictated by PostgreSQL\n                                                search_path.\n  --prefix arg                          Prefix added at the beginning of the\n                                        table names.\n  --suffix arg                          Suffix added at the end of the table\n                                        names.\n  --addnodes                            Import the osm_nodes, osm_ways \u0026\n                                        osm_relations tables.\n  --attributes                          Include attributes information.\n  --tags                                Include tag information.\n  --chunk arg (=20000)                  Exporting chunk size.\n  --clean                               Drop previously created tables.\n  --no-index                            Do not create indexes (Use when indexes\n                                        are already created)\n\nDatabase options:\n  -d [ --dbname ] arg            Name of your database (Required).\n  -U [ --username ] arg          Name of the user, which have write access to\n                                 the database.\n  -h [ --host ] arg (=localhost) Host of your postgresql database.\n  -p [ --port ] arg (=5432)      db_port of your database.\n  -W [ --password ] arg          Password for database access.\n\n```\n\n## Tips\n\nOpen Street Map (OSM) files contains tags not used at all for routing operations by PgRouting (i.e. author, version, timestamps, etc.). You can reduce a lot the size of your OSM file to import removing this metadata tags from original file (you can get around half size of original file).\n\nThe best tool to remove tags is [osmconvert](https://wiki.openstreetmap.org/wiki/Osmconvert).\nThere are another tools but osmconvert is the fastest parsing osm files.\n\nExample:\n```\n$ osmconvert output_data.osm.pbf --drop-author --drop-version --out-osm -o=output_data_reduc.osm\n```\n\nYou can download OSM data as PBF (protobuffer) format. This is a binary format and it has a lower size than OSM raw files (better for downloading operations).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FpgRouting%2Fosm2pgrouting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FpgRouting%2Fosm2pgrouting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FpgRouting%2Fosm2pgrouting/lists"}