From 5f601d2d6fc543ca396f286fa844578eef7951be Mon Sep 17 00:00:00 2001 From: Santiago Crespo Date: Sun, 30 Oct 2022 21:04:10 +0000 Subject: [PATCH] Upload files to 'src/pipelines/SIOSE' --- src/pipelines/SIOSE/process_SIOSE.sh | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/pipelines/SIOSE/process_SIOSE.sh diff --git a/src/pipelines/SIOSE/process_SIOSE.sh b/src/pipelines/SIOSE/process_SIOSE.sh new file mode 100644 index 0000000..48414a6 --- /dev/null +++ b/src/pipelines/SIOSE/process_SIOSE.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# SIOSE geojson to YAOM + +OUTFILENAME="landcover_SIOSE_MadMap.osm" + +set -e + +if [ $# -eq 0 ]; then + echo "Uso: $0 SIOSE_Madrid_2014.osm" + exit 1 +fi + +perl -pe "s/'/\"/g" $1 > in.osm +rm -f out.osm + +while IFS= read -r nametagscode +do + SIOSECODE=`echo "$nametagscode" | awk -F ',' '{print $3}'` + NAME=`echo "$nametagscode" | awk -F ',' '{print $1}'` + TAGVALUES=`echo "$nametagscode" | awk -F ',' '{print $2}'` + echo "Processing $NAME..." + if echo $TAGVALUES | grep "+" ; + then + echo $TAGVALUES | perl -pe 's/ \+ /\n/g' > /tmp/tagvalue + while IFS= read -r tagvalue + do + TAG=`echo "$tagvalue" | awk -F '=' '{print $1}'` + VALUE=`echo "$tagvalue" | awk -F '=' '{print $2}'` + echo "Adding $TAG=$VALUE..." +# perl -pe 's/ \n \n \n \n out.osm + +osmium renumber --start-id=100020000 out.osm -o tmp.osm + +perl -pe 's/id="/version="1" id="/g' tmp.osm > "$OUTFILENAME" && rm tmp.osm + +echo "OK. Abrir $OUTFILENAME en JOSM, pasar validación y borrar áreas y multipolígonos sin etiquetas" +echo 'josm "'$OUTFILENAME'"' +exit 0 + + + + +