summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-01-25 21:19:19 +0100
committerJonas Smedegaard <dr@jones.dk>2014-01-25 21:19:19 +0100
commitc02ea76fcf5b57c826689bf60c9aa89e4e02037c (patch)
tree289e12f83b8dbf48f1c0580a22fe549de6ab0136
parent77fbea5614ced7aeb4cdf543043d881c5c106b33 (diff)
Use builtin cURL (not wget), and tidy option handling.
-rwxr-xr-xlocalosmpath2geojson8
1 files changed, 4 insertions, 4 deletions
diff --git a/localosmpath2geojson b/localosmpath2geojson
index ded5391..6ff317b 100755
--- a/localosmpath2geojson
+++ b/localosmpath2geojson
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# Depends: wget gdal-bin perl-modules
+# Depends: gdal-bin perl-modules
set -eu
@@ -27,14 +27,14 @@ onlineosmxml2geojson() {
echo '['
first=yes
for feature in "$@"; do
+ url="http://www.openstreetmap.org/api/0.6/relation/$feature/full"
[ -n "$first" ] || echo ','
- wget -O- http://www.openstreetmap.org/api/0.6/relation/$feature/full \
- | ogr2ogr --config OSM_USE_CUSTOM_INDEXING NO -f GeoJSON /vsistdout/ /vsistdin/ multilinestrings
+ ogr2ogr --config OSM_USE_CUSTOM_INDEXING NO -f GeoJSON /vsistdout/ /vsicurl_streaming/"$url" multilinestrings
first=
done
echo ']'
}
-onlineosmxml2geojson "$@" \
+onlineosmxml2geojson $features \
| json_pp -json_opt pretty,canonical \
| perl -0 -pe 's/ /\t/g; s/},\s*{/}, {/g; s/\[\s*([\d.,]+)\s*([\d.]+)\s*\]/[$1 $2]/g'