From 4add507076c8cc10e69797ac6f675d068ada39d1 Mon Sep 17 00:00:00 2001 From: Santiago Crespo Date: Sun, 30 Oct 2022 20:53:09 +0000 Subject: [PATCH] Upload files to 'src/pipelines/arboles' --- .../procesa_arbolado_viario_scrapeado.sh | 200 ++++++++++++++++++ src/pipelines/arboles/scrape-trees.sh | 22 ++ 2 files changed, 222 insertions(+) create mode 100644 src/pipelines/arboles/procesa_arbolado_viario_scrapeado.sh create mode 100644 src/pipelines/arboles/scrape-trees.sh diff --git a/src/pipelines/arboles/procesa_arbolado_viario_scrapeado.sh b/src/pipelines/arboles/procesa_arbolado_viario_scrapeado.sh new file mode 100644 index 0000000..31f9bb7 --- /dev/null +++ b/src/pipelines/arboles/procesa_arbolado_viario_scrapeado.sh @@ -0,0 +1,200 @@ +#!/bin/bash +# Procesa el json (antes geojson) con los datos de "Un Alcorque un árbol" +# (Arbolado_Viario-23030.json) y lo transforma a formato OSM 4326 + +# PENDIENTE: MOVER A UN SCRIPT EXTERNO LA TAREA DE DESMONTAR Y MONTAR /tmp/ramdisk !! + + +INITIALDIR=`pwd` +TMPDIR=/tmp/ramdisk +mkdir -p $TMPDIR +sudo mount -t tmpfs -o size=12g tmpfs $TMPDIR || exit 1 + +cp Arbolado_Viario-23030.json $TMPDIR || exit 1 +cd $TMPDIR + +if [ ! -f /usr/bin/uni2ascii ]; then + echo "Instalando el paquete uni2ascii..." + sudo apt-get install uni2ascii -y || exit 1 +fi + +if [ ! -f /usr/bin/npm ]; then + echo "Instalando node y geojsontoosm..." + curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - + sudo apt-get install -y nodejs || exit 1 + sudo npm install -g geojsontoosm || exit 1 +fi + +if [ ! -f ./PENR2009.gsb ]; then + # Descarga y descomprime la rejilla para cambio de Datum entre ED50 y ETRS89 para la península del Instituto Geográfico Nacional: + wget http://www.ign.es/web/resources/docs/IGNCnig/GDS-TOOLS-PENR2009.zip || exit 1 + unzip GDS-TOOLS-PENR2009.zip || exit 1 +fi + +# Mantener nombre del archivo de salida para que añada una capa con el mismo nombre +ascii2uni -a U -q Arbolado_Viario-23030.json > a && mv a $TMPDIR/Arbolado_Viario-23030.json || exit 1 + +# FIX LAT and LONG (flip) +# Mantener nombre del archivo de entrada para que añada una capa con el mismo nombre +ogr2ogr -s_srs "+proj=latlong +datum=WGS84 +axis=neu +wktext" -t_srs "+proj=latlong +datum=WGS84 +axis=enu +wktext" Arbolado_Viario-23030-OK.json Arbolado_Viario-23030.json || exit 1 + +# Add SOURCEDATE +# PENDING: Sacar la fecha de algún sitio mejor que la fecha de procesamiento!!! +SOURCEDATE=`date +%Y-%m-%d` +perl -pe 's/"properties": \{ /"properties": \{ "SOURCEDATE": "'$SOURCEDATE'", /g' Arbolado_Viario-23030-OK.json > Arbolado_Viario-23030.json || exit 1 + +# Prepara la reproyección de EPSG:23030 a EPSG:4326 con la rejilla: + +# ERROR 1: Unable to find source field 'ARB_CODIGO'. +# Han quitado DATMOD,ALC_ALCORQUE y no hay sustitutos +# PENDING: circumference=0 +# diameter_crown=0 +# height=0 +# + echo ' + + Arbolado_Viario-23030 + ./Arbolado_Viario-23030.json + wkbPoint + +init=epsg:23030 +nadgrids=./PENR2009.gsb +wktext + + + + + + + + + + + + + + + + + ' > Arbolado_Viario-23030.vrt || exit 1 + +# PENDIENTE: meter todos los ID's +#MXASSETNUM y OBJECTID son iguales? = código usado en un alcorque un árbol + +# PENDIENTE: edad fenológica: +# "EDAD_FENOL": "M" + +# PENDIENTE: meter "TIPO_INTERFERENCIA"? Problemas visibilidad tráfico, edificios, etc. Posible uso para machine learning detectar problemas o zonas donde pueda haber problemas en el futuro. + +# PENDIENTE: VER ESTADOS +# "ESTADO": "OPERATIVO" +# "ESTADO": "ACTIVO" +# "ESTADO": "DESAPARECIDO" +# "ESTADO": "INACTIVO" +# "ESTADO": "NO PREPARADO" + +#PENDIENTE: VER OTROS +# "MINTBARRIO": "026" +# "NOMBRE_LOTE": "CENTRO-ESTE" +# "MINTSERVICIO": "40" +# "MINTHIERARCHYPATH": "JARDINERIA \\ ARBOLES \\ ARBOL_VIARIO" + # "ESA_ESPECIE": "PDA" +# "MXSITEID": "AGMAYM" +# "MINTUNIDAD_GESTION": "302522" +# "MINTOBSERVACIONES": "2.Emperador Carlos V (Arganzuela) +# Plaza ;3 " +# "NOMBRE_UGESTION": "2.Emperador Carlos V (Arganzuela) +# Plaza" +# "MINTDISTRITO": "02" +# "MINTDISTRITO_FUNC": "02" +# "MINTLOTE": "2" +# "NOMBRE_CONTRATO": "CONTRATO INTEGRAL DE GESTIÓN DEL SERVICIO PණLICO DE LIMPIEZA Y CONSERVACIÓN DE LOS ESPACIOS PණLICOS Y ZONAS VERDES" +# "NOMBRE_DISTRITO": "ARGANZUELA" +# "DESCRIPTION": "Arbol ARB_02-02_0000022208" +# "MINTCODPOSTAL": null +# "MINTCONTRATO": "5" +# "MINTNOMBREVIA": null +# "PARENT": "4135982" +# "NOMBRE_BARRIO": "PALOS DE MOGUER" +# "GLOBALID": "{6D943D3D-2820-4E33-BF57-0B06156A14CC}" +# "MINTDIRECCIONAUX": "PLAZA DEL EMPERADOR CARLOS V +# 6" +# "MINTSUPVERDE": null +# "MINTNUMEROVIA": null +# "NOMBRE_SUPVERDE": null +# "MINTNDP": null}} + + +# Reproyecta usando ogr2ogr (falla con -overwrite) +rm -f Arbolado_Viario-4326.json +#ogr2ogr -f GeoJSON -t_srs EPSG:4326 Arbolado_Viario-4326.json Arbolado_Viario-23030.vrt +ogr2ogr -f GeoJSON -s_srs "+proj=latlong +datum=WGS84 +axis=neu +wktext" -t_srs "+proj=latlong +datum=WGS84 +axis=enu +wktext" Arbolado_Viario-4326.json Arbolado_Viario-23030.vrt || exit 1 + + +# PENDIENTE: han añadido el campo SENESCENCIA para indicar el tipo de hoja: PERENNIFOLIO=evergreen; CADUCIFOLIO=broadleaved; ...? <- USAR ESTOS DATOS, ahora hay árboles con SENESCENCIA y sin leaf_type +perl -pe 's/"source:date"/"natural": "tree", "source": "Ayuntamiento de Madrid", "source:date"/g' Arbolado_Viario-4326.json | perl -pe 's/"species": "Platanus x hybrida"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Platanus x hybrida"/g' | perl -pe 's/"species": "Sophora japonica"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Sophora japonica"/g' | perl -pe 's/"species": "Ulmus pumila"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Ulmus pumila"/g' | perl -pe 's/"species": "Robinia pseudoacacia"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Robinia pseudoacacia"/g' | perl -pe 's/"species": "Ligustrum japonicum"/"leaf_type": "broadleaved", "leaf_cycle": "evergreen", "species": "Ligustrum japonicum"/g' | perl -pe 's/"species": "Celtis australis"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Celtis australis"/g' | perl -pe 's/"species": "Pinus pinea"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Pinus pinea"/g' | perl -pe 's/"species": "Morus alba"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Morus alba"/g' | perl -pe 's/"species": "Acer pseudoplatanus"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer pseudoplatanus"/g' | perl -pe 's/"species": "Prunus cerasifera pissardii"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Prunus cerasifera pissardii"/g' | perl -pe 's/"species": "Koelreuteria paniculata"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Koelreuteria paniculata"/g' | perl -pe 's/"species": "Acer platanoides"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer platanoides"/g' | perl -pe 's/"species": "Cercis siliquastrum"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Cercis siliquastrum"/g' | perl -pe 's/"species": "Acer campestre"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer campestre"/g' | perl -pe 's/"species": "Tilia platyphyllos"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Tilia platyphyllos"/g' | perl -pe 's/"species": "Gleditsia triacanthos '\''Inermis'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Gleditsia triacanthos '\''Inermis'\''"/g' | perl -pe 's/"species": "Fraxinus angustifolia"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Fraxinus angustifolia"/g' | perl -pe 's/"species": "Acer freemanii"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer freemanii"/g' | perl -pe 's/"species": "Pyrus calleryana"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Pyrus calleryana"/g' | perl -pe 's/"species": "Broussonetia papyrifera"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Broussonetia papyrifera"/g' | perl -pe 's/"species": "Ulmus pumila '\''Umbraculifera'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Ulmus pumila '\''Umbraculifera'\''"/g' | perl -pe 's/"species": "Albizia julibrissin"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Albizia julibrissin"/g' | perl -pe 's/"species": "Pyrus calleryana '\''Chanticlear'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Pyrus calleryana '\''Chanticlear'\''"/g' | perl -pe 's/"species": "Celtis occidentalis"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Celtis occidentalis"/g' | perl -pe 's/"species": "Ginkgo biloba"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Ginkgo biloba"/g' | perl -pe 's/"species": "Ailanthus altissima"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Ailanthus altissima"/g' | perl -pe 's/"species": "Fraxinus excelsior"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Fraxinus excelsior"/g' | perl -pe 's/"species": "Ligustrum japonicum '\''Variegata'\''"/"leaf_type": "broadleaved", "leaf_cycle": "evergreen", "species": "Ligustrum japonicum '\''Variegata'\''"/g' | perl -pe 's/"species": "Cupressus sempervirens"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Cupressus sempervirens"/g' | perl -pe 's/"species": "Morus alba '\''Fruitless'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Morus alba '\''Fruitless'\''"/g' | perl -pe 's/"species": "Tilia cordata"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Tilia cordata"/g' | perl -pe 's/"species": "Robinia pseudoacacia '\''Umbraculifera'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Robinia pseudoacacia '\''Umbraculifera'\''"/g' | perl -pe 's/"species": "Crataegus x lavallei '\''Carrierei'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Crataegus x lavallei '\''Carrierei'\''"/g' | perl -pe 's/"species": "Populus alba bolleana"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Populus alba bolleana"/g' | perl -pe 's/"species": "Morus nigra"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Morus nigra"/g' | perl -pe 's/"species": "Fraxinus ornus"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Fraxinus ornus"/g' | perl -pe 's/"species": "Hibiscus syriacus"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Hibiscus syriacus"/g' | perl -pe 's/"species": "Carpinus betulus"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Carpinus betulus"/g' | perl -pe 's/"species": "Fraxinus americana"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Fraxinus americana"/g' | perl -pe 's/"species": "Cupressus arizonica"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Cupressus arizonica"/g' | perl -pe 's/"species": "Pinus halepensis"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Pinus halepensis"/g' | perl -pe 's/"species": "Acer saccharinum"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer saccharinum"/g' | perl -pe 's/"species": "Liquidambar styraciflua"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Liquidambar styraciflua"/g' | perl -pe 's/"species": "Tilia cordata '\''Greenspire'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Tilia cordata '\''Greenspire'\''"/g' | perl -pe 's/"species": "Ulmus minor"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Ulmus minor"/g' | perl -pe 's/"species": "Malus floribunda"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Malus floribunda"/g' | perl -pe 's/"species": "Lagerstroemia indica"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Lagerstroemia indica"/g' | perl -pe 's/"species": "Firmiana simplex"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Firmiana simplex"/g' | perl -pe 's/"species": "Platanus orientalis"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Platanus orientalis"/g' | perl -pe 's/"species": "Quercus ilex"/"leaf_type": "broadleaved", "leaf_cycle": "semi_evergreen", "species": "Quercus ilex"/g' | perl -pe 's/"species": "Acer monspessulanum"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer monspessulanum"/g' | perl -pe 's/"species": "Prunus cerasifera pisardii"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Prunus cerasifera pisardii"/g' | perl -pe 's/"species": "Acacia dealbata"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Acacia dealbata"/g' | perl -pe 's/"species": "Ulmus campestris"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Ulmus campestris"/g' | perl -pe 's/"species": "Acer freemanii '\''Autumn Blaze'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer freemanii '\''Autumn Blaze'\''"/g' | perl -pe 's/"species": "Liriodendron tulipifera"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Liriodendron tulipifera"/g' | perl -pe 's/"species": "Fraxinus angustifolia '\''Raywood'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Fraxinus angustifolia '\''Raywood'\''"/g' | perl -pe 's/"species": "Malus sp"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Malus sp"/g' | perl -pe 's/"species": "Prunus serrulata"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Prunus serrulata"/g' | perl -pe 's/"species": "Populus x canadensis"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Populus x canadensis"/g' | perl -pe 's/"species": "Pyrus communis"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Pyrus communis"/g' | perl -pe 's/"species": "Populus alba"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Populus alba"/g' | perl -pe 's/"species": "Prunus serrulata '\''Kanzan'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Prunus serrulata '\''Kanzan'\''"/g' | perl -pe 's/"species": "Acer x freemanii"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer x freemanii"/g' | perl -pe 's/"species": "Tilia x europaea"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Tilia x europaea"/g' | perl -pe 's/"species": "Catalpa bungei"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Catalpa bungei"/g' | perl -pe 's/"species": "Betula sp"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Betula sp"/g' | perl -pe 's/"species": "Acacia cyclops"/"leaf_type": "broadleaved", "leaf_cycle": "evergreen", "species": "Acacia cyclops"/g' | perl -pe 's/"species": "Acer buergerianum"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer buergerianum"/g' | perl -pe 's/"species": "Magnolia grandiflora"/"leaf_type": "broadleaved", "leaf_cycle": "evergreen", "species": "Magnolia grandiflora"/g' | perl -pe 's/"species": "Cedrus deodara"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Cedrus deodara"/g' | perl -pe 's/"species": "Cupressocyparis leylandii"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Cupressocyparis leylandii"/g' | perl -pe 's/"species": "Elaeagnus angustifolia"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Elaeagnus angustifolia"/g' | perl -pe 's/"species": "Tilia americana"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Tilia americana"/g' | perl -pe 's/"species": "Tilia tomentosa"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Tilia tomentosa"/g' | perl -pe 's/"species": "Tamarix gallica"/"leaf_type": "needleleaved", "leaf_cycle": "deciduous", "species": "Tamarix gallica"/g' | perl -pe 's/"species": "Zelkova serrata"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Zelkova serrata"/g' | perl -pe 's/"species": "Pawlonia tomentosa"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Pawlonia tomentosa"/g' | perl -pe 's/"species": "Photinia serrulata"/"leaf_type": "broadleaved", "leaf_cycle": "evergreen", "species": "Photinia serrulata"/g' | perl -pe 's/"species": "Abies alba"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Abies alba"/g' | perl -pe 's/"species": "Acer negundo '\''Variegatum'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Acer negundo '\''Variegatum'\''"/g' | perl -pe 's/"species": "Betula pendula"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Betula pendula"/g' | perl -pe 's/"species": "Robinia pseudoacacia '\''Casque Rouge'\''"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Robinia pseudoacacia '\''Casque Rouge'\''"/g' | perl -pe 's/"species": "Populus nigra"/"leaf_type": "broadleaved", "leaf_cycle": "deciduous", "species": "Populus nigra"/g' | perl -pe 's/"species": "Taxus baccata"/"leaf_type": "needleleaved", "leaf_cycle": "evergreen", "species": "Taxus baccata"/g' > $TMPDIR/a.json || exit 1 + +# para generar el listado de tipos de hoja a partir del csv: +#awk -F ',' '{print "perl -pe \x27s/\"species\": \""$1"\"/\"leaf_type\": \""$2"\", \"leaf_cycle\": \""$3"\", \"species\": \""$1"\"/g\x27"}' h.csv + +# Con 4096 y 14000: +# FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory +#node --max-old-space-size=4096 /usr/lib/node_modules/geojsontoosm/geojsontoosm $TMPDIR/a.json > $TMPDIR/a.osm +#node --max-old-space-size=8192 /usr/lib/node_modules/geojsontoosm/geojsontoosm $TMPDIR/a.json > $TMPDIR/a.osm + +echo"PENDIENTE: NO FUNCIONA la conversión de geojson a OSM. HECHA CON JOSM POR AHORA" +echo "Guardar como $TMPDIR/a.osm" +mv $TMPDIR/a.json $TMPDIR/a.geojson + +josm $TMPDIR/a.geojson || exit 1 + +# OPCION 1: NO FUNCIONA +#node --max-old-space-size=25000 /usr/local/lib/node_modules/geojsontoosm/geojsontoosm $TMPDIR/a.json > $TMPDIR/a.osm || exit 1 + +# OPCION 2: NO FUNCIONA +#json2csv -i a.json -o a.csv # SIN MEMORIA +#csv2osm.py a.csv a.osm + +# RENUMBERING +perl -pe 's/ $TMPDIR/b.osm || exit 1 +INITIALID="70000500000" + +#rm -f c.osm rm a.json a.osm Arbolado_Viario-23030.json Arbolado_Viario-23030-OK.json Arbolado_Viario-4326.json + +# PENDIENTE: TARDA LA VIDA, OPTIMIZAR +while IFS='' read -r line || [[ -n "$line" ]]; do + echo "$line" > $TMPDIR/line + + if grep --quiet "node id" $TMPDIR/line; then + PREID="`cat $TMPDIR/line | awk -F '"' '{print $1}'`" + OBJID="`cat $TMPDIR/line | awk -F '"' '{print $2}'`" + cut -d \" -f 3- $TMPDIR/line > $TMPDIR/posid + POSID="`cat $TMPDIR/posid`" + NEWID=$((OBJID + INITIALID)) + echo "$PREID\"$NEWID\"$POSID" >> $TMPDIR/c.osm + else + echo "$line" >> $TMPDIR/c.osm + fi +done < $TMPDIR/b.osm + +perl -pe 's/node id/node version="1" id/g' $TMPDIR/c.osm > $INITIALDIR/Arbolado_Viario.osm +cd $INITIALDIR + +sudo umount $TMPDIR + + +############# +# Ver: +# EDADFENOLOGICA=Tocón +# circumference=[object Object] + + +#date -d 20170302 +%Y-%m-%d + + +#Solicitar a la Dirección General de Medio Ambiente, los árboles catalogados como singulares. + +#VER: Ginkgo biloba + +#VER: Pyrus communis +#Peral + +#VER: Acacia dealbata +#Debido a su potencial colonizador y constituir una amenaza grave para las especies autóctonas, los hábitats o los ecosistemas, ha sido catalogada en el Catálogo Español de Especies exóticas Invasoras, aprobado por Real Decreto 630/2013, de 2 de agosto, estando prohibida en España su introducción en el medio natural, posesión, transporte, tráfico y comercio. diff --git a/src/pipelines/arboles/scrape-trees.sh b/src/pipelines/arboles/scrape-trees.sh new file mode 100644 index 0000000..ebaf33e --- /dev/null +++ b/src/pipelines/arboles/scrape-trees.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# scrapea árboles + +CURRENTDIR=`pwd` + +cd +virtualenv esridump +source esridump/bin/activate +pip install esridump + +# Por defecto saca 4326 mal reproyectado (sin la rejilla del IGN) +#esri2geojson http://iws.munimadrid.es/arcgis/rest/services/DGPV/DGPV_ALCORQUE_ARBOL/MapServer/0 /tmp/arboles.geojson + +# Sacar URL rest cuando cambia la web "Un Alcorque un Árbol" . 202209: https://www-s.madrid.es/DGPVE_WUAUA/irAMapa.do +# Tarda unos 10 minutos +esri2geojson --param "query?where=OBJECTID&f=json" https://sigma.madrid.es/vector/rest/services/MTMOV/MPUAUA/MapServer/0 Arbolado_Viario-23030.json || exit 1 + +mv Arbolado_Viario-23030.json "$CURRENTDIR" || exit 1 + +exit 0 +