diff options
-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 |