Skip to content
/ osm2shp Public

Converts osm-files to shapefiles. Based on osm2shp from Geofabrik, but with better configuration.

Notifications You must be signed in to change notification settings

plepe/osm2shp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

============================================================================

This program converts OSM XML to ESRI Shape Files.

You can define the layout of the shape files which will be created in the osm2shp.cfg file. After changing this file you have to run 'make' again.

Note that this program creates UTF-8 shape files by default but you can specify
-DLATIN1 when compiling to switch to LATIN-1.

This program does not support relations and therefore no multipolygons either.

This progam is capable of producing very large shape files so be careful what 
you feed it. Unfortunately, neither reading from stdin nor reading compressed
or binary formats is supported so you really have to have a .osm file for input.

Written by Frederik Ramm <[email protected]>, public domain
Improved by Stephan Plepelits <[email protected]>, public domain

============================================================================

Syntax of the osm2shp.cfg-file:

The osm2shp.cfg contains several blocks, each of them defining a shape file.
Empty lines and lines starting with a # will be ignored.

* file <format> "<name>"
Every new block starts with a "file" line:
- The first parameter defines the format of the shapefile. Possible values:
  point, line, polygon
- The second parameter defines the name in quotation marks

Example:
file point "places"
Defines a file of points with the name places

* where key "<key>" [key "<key>"]
Every block can have one or more where-lines. Each where line defines whether an osm object should be added to the shapefile or not.
- The first parameter has to be 'key'
- The second parameter defines a key in quotation marks
You can repeat the parameters to add more keys (they will be linked by or)
If you add several where-lines or one where line with several keys does not
matter.

Example:
where key "landuse" key "leisure"
Add all object which have a key "landuse" or a key "leisure"

* column type "<name>" [key "<key>"]
Defines a column to the shapefile.
- The first parameter defines the type of the column, possible values: string,
  int, float
- The second parameter defines the name of the column in quotation marks
- optionally you can define one or several key-parameters. The value of the
  column <name> will be one of those keys (the first key-parameter has highest
  priority). If no key-parameters are supplied, the value of key <name> will be
  used.

Example:
column string "name"
If the osm object has a key "name" it will be copied to the column "name".

column string "type" key "landuse" key "leisure"
If the object has a key "landuse" or a key "leisure" one of those values will
be copied to the shapefile, whereas the column in the shapefile is called
"type". "landuse" has higher priority than "leisure".

About

Converts osm-files to shapefiles. Based on osm2shp from Geofabrik, but with better configuration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages