mugiss-extract
is a tool for extracting cities boundaries from OpenStreetMap PBF files and exporting them in a CSV file.
City extraction is based on the boundary
and admin_level
tags in OpenStreetMap.
On Debian/Ubuntu:
# apt-get install libgeos-dev
$ git clone https://github.com/fg1/mugiss-extract.git
$ cd mugiss-extract
$ go get
$ go build
Usage: mugiss-extract [global options]
Global options:
-i, Input OpenStreetMap PBF data file (*)
-l, Admin level (default: 8)
-m, Minimal admin level (default: 6)
-o, Output CSV data file (*)
The CSV file format follows the gisgraphy cities file format. The columns are:
1 : Node type; N|W|R (in uppercase), wheter it is a Node, Way or Relation in the openstreetmap Model
2 : id; The openstreetmap id
3 : name; the default name of the city
4 : countrycode; The iso3166-2 country code (2 letters)
5 : postcode; The postcode / zipcode / ons code / municipality code / ...
6 : population; How many people lives in that city
7 : location; The middle location of the city in HEXEWKB
8 : shape; The delimitation of the city in HEXEWKB
9 : type; the type of city ('city', 'village', 'town', 'hamlet', ...)
10 : is_in ; where the cities is located (generally the fully qualified administrative division)
11 : alternatenames; the names of the city in other languages
Contributions are welcome. Have a look at the TODO list above, or come with your own features.
- Fork the repository
- Create your feature branch (
git checkout -b my-feature
) - Format your changes (
go fmt
) and commit it (git commit -am 'Commit message'
) - Push to the branch (
git push origin my-feature
) - Create a pull request