diff options
author | Jonas Smedegaard <dr@jones.dk> | 2014-02-27 16:30:20 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2014-02-27 16:30:20 +0100 |
commit | 585f82d39da29febe00fbb7f7989de4a7671b088 (patch) | |
tree | 4bb583efc0a720ea8053d83f587e7ea798d304e5 /localosmfeature2geojson | |
parent | 6498361a5f543aac82fc58cf60c25c8e7426c6af (diff) |
Support node objects.
Diffstat (limited to 'localosmfeature2geojson')
-rwxr-xr-x | localosmfeature2geojson | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/localosmfeature2geojson b/localosmfeature2geojson index 1389a82..dfd1a26 100755 --- a/localosmfeature2geojson +++ b/localosmfeature2geojson @@ -1,7 +1,7 @@ #!/bin/sh # # Copyright © 2014 Jonas Smedegaard <dr@jones.dk> -# Description: resolve GeoJSON from OSM way or relation. +# Description: resolve GeoJSON from OSM node, way and relation objects. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ set -eu -# type must be either polygons or lines +# type must be either polygons, lines or points type="$1"; shift features=$* @@ -30,7 +30,14 @@ onlineosmxml2geojson() { echo '[' first=yes for feature in "$@"; do - url="http://www.openstreetmap.org/api/0.6/$feature/full" + case "$feature" in + node/*) + url="http://www.openstreetmap.org/api/0.6/$feature" + ;; + *) + url="http://www.openstreetmap.org/api/0.6/$feature/full" + ;; + esac [ -n "$first" ] || echo ',' case "$type" in polygons) @@ -39,6 +46,9 @@ onlineosmxml2geojson() { lines) ogr2ogr --config OSM_USE_CUSTOM_INDEXING NO -nlt PROMOTE_TO_MULTI -f GeoJSON /vsistdout/ /vsicurl_streaming/"$url" multilinestrings ;; + points) + ogr2ogr --config OSM_USE_CUSTOM_INDEXING NO -f GeoJSON /vsistdout/ /vsicurl_streaming/"$url" points + ;; esac first= done |