From 585f82d39da29febe00fbb7f7989de4a7671b088 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 27 Feb 2014 16:30:20 +0100 Subject: Support node objects. --- localosmfeature2geojson | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'localosmfeature2geojson') diff --git a/localosmfeature2geojson b/localosmfeature2geojson index 1389a82..dfd1a26 100755 --- a/localosmfeature2geojson +++ b/localosmfeature2geojson @@ -1,7 +1,7 @@ #!/bin/sh # # Copyright © 2014 Jonas Smedegaard -# 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 -- cgit v1.2.3