diff options
author | Jonas Smedegaard <dr@jones.dk> | 2014-02-27 16:12:21 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2014-02-27 16:12:21 +0100 |
commit | 6498361a5f543aac82fc58cf60c25c8e7426c6af (patch) | |
tree | 2ecef516011b77ab738c0ef2fc1c9911f6b5ceb0 /localosmfeature2geojson | |
parent | 6c815d383cba75225afdd76a35cdf7ab10696b7d (diff) |
Support either (multi)polygons and (multi)lines, declared as mandatory first argument.
Diffstat (limited to 'localosmfeature2geojson')
-rwxr-xr-x | localosmfeature2geojson | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/localosmfeature2geojson b/localosmfeature2geojson index dfe35e5..1389a82 100755 --- a/localosmfeature2geojson +++ b/localosmfeature2geojson @@ -20,6 +20,9 @@ set -eu +# type must be either polygons or lines +type="$1"; shift + features=$* onlineosmxml2geojson() { @@ -29,7 +32,14 @@ onlineosmxml2geojson() { for feature in "$@"; do url="http://www.openstreetmap.org/api/0.6/$feature/full" [ -n "$first" ] || echo ',' - ogr2ogr --config OSM_USE_CUSTOM_INDEXING NO -f GeoJSON /vsistdout/ /vsicurl_streaming/"$url" multilinestrings + case "$type" in + polygons) + ogr2ogr --config OSM_USE_CUSTOM_INDEXING NO -nlt PROMOTE_TO_MULTI -f GeoJSON /vsistdout/ /vsicurl_streaming/"$url" multipolygons + ;; + lines) + ogr2ogr --config OSM_USE_CUSTOM_INDEXING NO -nlt PROMOTE_TO_MULTI -f GeoJSON /vsistdout/ /vsicurl_streaming/"$url" multilinestrings + ;; + esac first= done echo ']' |