- Notifications
You must be signed in to change notification settings - Fork120
tyrasd/osmtogeojson
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ConvertsOSMdata toGeoJSON. Try thedemo!
- stable
- real OSMpolygon detection
- proper OSM multipolygon support
- full support for extended Overpass APIgeometry modes
- welltested and proven
- fast
This code is used in and maintained by theoverpass turbo project.
Installation:
$ npm install -g osmtogeojson
Usage:
$ osmtogeojson file.osm > file.geojson
Supported command line options are shown with:
$ osmtogeojson --help
When working with extra large data files (≳ 100 MB) it is recommended to run the programm with a little extra memory to avoidprocess out of memory errors. The easiest way to do this is by running the command asnode <path-to-osmtogeojson>
and setting the--max_old_space_size=…
parameter to the available memory size in MB (osmtogeojson typically needs about 4-5 times the input data size). On a Unix system, you can use the following command:
$ node --max_old_space_size=8192 `which osmtogeojson` large.osm > large.geojson
Installation:
$ npm install osmtogeojson
Usage:
var osmtogeojson = require('osmtogeojson');osmtogeojson(osm_data);
<script src='osmtogeojson.js'></script>osmtogeojson(osm_data);
Converts OSM data into GeoJSON.
data
: the OSM data. Either as a XML DOM or inOSM JSON.options
: optional. The following options can be used:flatProperties
: If true, the resulting GeoJSON feature's properties will be a simple key-value list instead of a structured json object (with separate tags and metadata). default: falseuninterestingTags
: Either ablacklist of tag keys or a callback function. Will be used to decide if a feature isinteresting enough for its own GeoJSON feature.polygonFeatures
: Either ajson object or callback function that is used to determine if a closed way should be treated as a Polygon or LineString.read more
The result is a javascript object of GeoJSON data:
The GeoJSON produced by this library will include exactly one GeoJSON-feature for each of the following OSM objects (that is everything that is also visible in overpass turbo's map view):
- all unconnected orinteresting tagged nodes (POIs)
- all ways (exceptuninteresting multipolygon outlines)
- all multipolygons (simple multipolygons with exactly one closed outer way are present via their outer way)
All data is given as a FeatureCollection. Each Feature in the collection has anid
property that is formed from the type and id of the original OSM object (e.g.node/123
) and has the memberproperties
containing the following data:
type
: the OSM data typeid
: the OSM idtags
: a collection of all tagsmeta
: metainformaton about the feature (e.g. version, timestamp, user, etc.)relations
: an array of relations the feature is member of. Each relation is encoded as an object literal containing the following properties:role
(membership role),rel
(the relation's id) andreltags
(contains all tags of the relation)tainted
: this flag is set when the feature's geometry is incomplete (e.g. missing nodes of a way or missing ways of a multipolygon)
If theoptionflatProperties
is set to true, theproperties
object will not contain any nested object literals, but directly provide a concise id, meta data and the tags of the respective OSM object.
About
convert osm to geojson
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.