osm2ch

command
v1.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2020 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

README

osm2ch

Convert *.osm.pbf files to CSV

About

With this CLI tool you can convert *.osm.pbf (Compressed Open Street Map) file to CSV (Comma-Separated Values) file, which is used in our contraction hierarchies library. What it does:

  • Edge expansion (single edge == single vertex);
  • Handles some kind and types of restrictions:
    • Supported kind of restrictions:
      • EdgeFrom - NodeVia - EdgeTo.
    • Supported types of restrictions:
      • only_left_turn;
      • only_right_turn;
      • only_straight_on;
      • no_left_turn;
      • no_right_turn;
      • no_straight_on.
  • Saves CSV file with geom in WKT format;
  • Currently supports tags for 'highway' OSM entity only.

PRs are welcome!

Installation

go install github.com/LdDl/ch/...

After installation step is complete you can call 'osm2ch' from any place in your system.

Usage

osm2ch -h

Output:

Usage of osm2ch:
  -file string
        Filename of *.osm.pbf file (it has to be compressed) (default "my_graph.osm.pbf")
  -geomf string
        Format of output geometry. Expected values: wkt / geojson (default "wkt")
  -out string
        Filename of 'Comma-Separated Values' (CSV) formatted file (default "my_graph.csv")
  -tags string
        Set of needed tags (separated by commas) (default "motorway,primary,primary_link,road,secondary,secondary_link,residential,tertiary,tertiary_link,unclassified,trunk,trunk_link")

The default list of tags is this, since usually these tags are used for routing for personal cars.

Example

You can find example file of *.osm.pbf file in nested child /example_data.

If you want WKT format for output geometry:

osm2ch --file example_data/moscow_center_reduced.osm.pbf --out graph.csv --geomf wkt --tags motorway,primary,primary_link,road,secondary,secondary_link,residential,tertiary,tertiary_link,unclassified,trunk,trunk_link

If you want GeoJSON format for output geometry:

osm2ch --file example_data/moscow_center_reduced.osm.pbf --out graph.csv --geomf geojson --tags motorway,primary,primary_link,road,secondary,secondary_link,residential,tertiary,tertiary_link,unclassified,trunk,trunk_link

After that file 'graph.csv' will be created. Header of CSV-file is: from_vertex_id;to_vertex_id;weights;geom

  • from_vertex_id Source vertex;
  • to_vertex_id Target vertex;
  • weight Traveling cost from source to target (actually length of edge in kilometers);
  • geom Geometry of edge in WKT or GeoJSON format.

Now you can use this graph in contraction hierarchies library.

Dependencies

Thanks to paulmach for his OSM-parser written in Go.

Paulmach's license is here (it's MIT)

License

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL