Script zum Download von feuerwehrrelevanten Daten

Hallo Zusammen,

ich habe für unsere Freiwillige Feuerwehr eine Webanwendung für ein Tablet mit Kartendarstellung entwickelt welche ohne Internetanbindung arbeitet. Für die Aktualisierung der Karte habe ich mir ein kleines Batch-Script geschrieben, welches mir den Update-Vorgang erleichtert.

Ich veröffentliche Mal hier den Inhalt der Batch-Datei und die Verzeichnisstruktur. Vielleicht kann noch jemand etwas mit damit anfangen.

Ausgegeben im Ready-Verzeichnis werden:

Rettungspunkte
Hydranten
Feuerwehrhäuser
Saugstellen
PV-Anlagen
Löschwasserbehälter

jeweils in den Formaten csv, gpx, kml und osm,

und eine OSM-Karte der Gemeinde und des Landkreises in OSM- und Garmin-Format.

Ein Teil der Daten wird in einem zweiten Schritt in die Tablet-Software importiert.

Zum Einsatz kommen die Programme:

wget
splitter
sed
osmfilter
osmconvert
mkgmap
gpsbabel
Java JRE 64 bit

Verzeichnisstruktur:

c:\osm\tools\gpsbabel
c:\osm\tools\mkgmap
c:\osm\tools\osmconvert
c:\osm\tools\osmfilter
c:\osm\tools\sed
c:\osm\tools\splitter
c:\osm\tools\wget
c:\osm\tools\cities15000.zip
c:\osm\tools\oberzent.poly
c:\osm\tools\odenwaldkreis.poly
c:\osm\tools\odw_access_point_firstline.txt (node;lon;lat;ref;operator;name)
c:\osm\tools\odw_access_point_kml_firstline.txt
c:\osm\tools\odw_fire_hydrant_firstline.txt
c:\osm\tools\odw_fire_hydrant_kml_firstline.txt
c:\osm\tools\odw_fire_station_firstline.txt
c:\osm\tools\odw_fire_water_pond_firstline.txt
c:\osm\tools\odw_generator_solar_firstline.txt
c:\osm\tools\odw_suction_point_firstline.txt
c:\osm\tools\odw_water_tank_firstline.txt
c:\osm\ready
c:\osm\temp
c:\osm\start_job.cmd

Inhalt der start_job.cmd:


REM ################--Aufraumen und vorbereiten--################

mkdir c:\osm\temp
mkdir c:\osm\ready
del c:\osm\temp\*.img /s /q
del c:\osm\temp\*.csv /s /q
del c:\osm\temp\*.gpx /s /q
del c:\osm\temp\*.pbf /s /q
del c:\osm\temp\*.* /s /q
del c:\osm\ready\*.* /s /q




REM ################--Aufraumen und vorbereiten--################

REM ################--Download der OSM Daten--################

cd C:\osm\tools\wget\bin\
wget.exe http://download.geofabrik.de/europe/germany/hessen-latest.osm.pbf
REM -statt dessen nächste Zeile wenn nicht jedes Mal hessen gezogen werden soll
REM copy C:\osm\hessen-latest.osm.pbf C:\osm\tools\wget\bin\
copy hessen-latest.osm.pbf C:\osm\temp\
del C:\osm\tools\wget\bin\*.pbf /s /q

REM ################--Download der OSM Daten--################




REM ################--Verkleinere OSM Datei mittels .poly--################ start

cd c:\osm\tools\osmconvert\
osmconvert c:\osm\temp\hessen-latest.osm.pbf --out-o5m >c:\osm\temp\hessen-latest.osm.o5m --hash-memory=1024


osmconvert c:\osm\temp\hessen-latest.osm.o5m -B=c:\osm\tools\odenwaldkreis.poly -o=c:\osm\temp\odw.osm.o5m --hash-memory=1024
osmconvert c:\osm\temp\hessen-latest.osm.o5m -B=c:\osm\tools\oberzent.poly -o=c:\osm\temp\oberzent.osm.o5m --hash-memory=1024

osmconvert c:\osm\temp\odw.osm.o5m --out-pbf >c:\osm\temp\odw-latest.pbf --hash-memory=1024
osmconvert c:\osm\temp\oberzent.osm.o5m --out-pbf >c:\osm\temp\oberzent-latest.pbf --hash-memory=1024
osmconvert c:\osm\temp\odw-latest.pbf >c:\osm\temp\odw-latest.osm --hash-memory=1024
osmconvert c:\osm\temp\oberzent-latest.pbf >c:\osm\temp\oberzent-latest.osm --hash-memory=1024

copy c:\osm\temp\odw-latest.pbf c:\osm\ready\odw-latest.pbf
copy c:\osm\temp\oberzent-latest.pbf c:\osm\ready\oberzent-latest.pbf

REM -folgende Zeile kann aus Platzbedarf auch weggelassen werden
copy c:\osm\temp\odw-latest.osm c:\osm\ready\odw-latest.osm
copy c:\osm\temp\oberzent-latest.osm c:\osm\ready\oberzent-latest.osm



REM ################--Verkleinere OSM Datei mittels .poly--################ end


REM ################--extrahiere POI aus OSM--################ start

c:\osm\tools\osmfilter\osmfilter c:\osm\temp\odw-latest.osm --keep="emergency=fire_hydrant" >c:\osm\temp\odw_fire_hydrant.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\odw-latest.osm --keep="emergency=water_tank" >c:\osm\temp\odw_water_tank.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\odw-latest.osm --keep="emergency=fire_water_pond" >c:\osm\temp\odw_fire_water_pond.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\odw-latest.osm --keep="emergency=suction_point" >c:\osm\temp\odw_suction_point.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\odw-latest.osm --keep="highway=emergency_access_point" >c:\osm\temp\odw_access_point.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\odw-latest.osm --keep="generator:source=solar" >c:\osm\temp\odw_generator_solar.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\odw-latest.osm --keep="amenity=fire_station" >c:\osm\temp\odw_fire_station.osm


c:\osm\tools\osmfilter\osmfilter c:\osm\temp\oberzent-latest.osm --keep="emergency=fire_hydrant" >c:\osm\temp\oberzent_fire_hydrant.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\oberzent-latest.osm --keep="emergency=water_tank" >c:\osm\temp\oberzent_water_tank.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\oberzent-latest.osm --keep="emergency=fire_water_pond" >c:\osm\temp\oberzent_fire_water_pond.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\oberzent-latest.osm --keep="emergency=suction_point" >c:\osm\temp\oberzent_suction_point.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\oberzent-latest.osm --keep="highway=emergency_access_point" >c:\osm\temp\oberzent_access_point.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\oberzent-latest.osm --keep="generator:source=solar" >c:\osm\temp\oberzent_generator_solar.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\oberzent-latest.osm --keep="amenity=fire_station" >c:\osm\temp\oberzent_fire_station.osm


REM extrahiere Hausnummern
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\oberzent-latest.osm --keep-nodes=building >c:\osm\temp\oberzent_hausnummer.osm
c:\osm\tools\osmfilter\osmfilter c:\osm\temp\odw-latest.osm --keep-nodes=building >c:\osm\temp\odw_hausnummer.osm
REM extrahiere Hausnummern

copy c:\osm\temp\odw_*.osm c:\osm\ready\
copy c:\osm\temp\oberzent_*.osm c:\osm\ready\

REM ################--extrahiere POI aus OSM--################ end


REM ################--CSV erstellen--################ start

c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_fire_hydrant.osm --all-to-nodes --csv="@id @lon @lat fire_hydrant:type fire_hydrant:position fire_hydrant:diameter" --csv-headline --hash-memory=48 -o=c:\osm\ready\tmp_odw_fire_hydrant.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_water_tank.osm --all-to-nodes --csv="@id @lon @lat water_tank:volume" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_odw_water_tank.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_fire_water_pond.osm --all-to-nodes --csv="@id @lon @lat fire_water_pond:name" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_odw_fire_water_pond.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_suction_point.osm --all-to-nodes --csv="@id @lon @lat suction_point:waterway" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_odw_suction_point.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_access_point.osm --all-to-nodes --csv="@id @lon @lat ref operator name" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_odw_access_point.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_generator_solar.osm --all-to-nodes --csv="@id @lon @lat generator:method" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_odw_generator_solar.csv --csv-separator=;

c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_fire_hydrant.osm --all-to-nodes --csv="@id @lon @lat fire_hydrant:type fire_hydrant:position fire_hydrant:diameter" --csv-headline --hash-memory=48 -o=c:\osm\ready\tmp_oberzent_fire_hydrant.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_water_tank.osm --all-to-nodes --csv="@id @lon @lat water_tank:volume" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_oberzent_water_tank.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_fire_water_pond.osm --all-to-nodes --csv="@id @lon @lat fire_water_pond:name" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_oberzent_fire_water_pond.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_suction_point.osm --all-to-nodes --csv="@id @lon @lat suction_point:waterway" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_oberzent_suction_point.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_access_point.osm --all-to-nodes --csv="@id @lon @lat ref operator name" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_oberzent_access_point.csv --csv-separator=;
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_generator_solar.osm --all-to-nodes --csv="@id @lon @lat generator:method" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_oberzent_generator_solar.csv --csv-separator=;

c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_hausnummer.osm --all-to-nodes --csv="@id @lon @lat addr:housenumber addr:city addr:street addr:postcode" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_oberzent_hausnummer.csv --csv-separator=;
C:\osm\tools\sed\bin\sed.exe -i "/;;;;/d" c:\osm\ready\tmp_oberzent_hausnummer.csv
C:\osm\tools\sed\bin\sed.exe -i "/;;Oberzent;;64760/d" c:\osm\ready\tmp_oberzent_hausnummer.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Hirschhorn;/d" c:\osm\ready\tmp_oberzent_hausnummer.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Mossautal;/d" c:\osm\ready\tmp_oberzent_hausnummer.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Erbach;/d" c:\osm\ready\tmp_oberzent_hausnummer.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Eberbach;/d" c:\osm\ready\tmp_oberzent_hausnummer.csv


c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_hausnummer.osm --all-to-nodes --csv="@id @lon @lat addr:housenumber addr:city addr:street addr:postcode" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_odw_hausnummer.csv --csv-separator=;
C:\osm\tools\sed\bin\sed.exe -i "/;;;;/d" c:\osm\ready\tmp_odw_hausnummer.csv


REM ################--CSV erstellen--################ end





REM ################--CSV GARMIN erstellen--################ start

REM Hydranten export
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_fire_hydrant.osm --all-to-nodes --csv="@lon @lat fire_hydrant:type fire_hydrant:diameter" --csv-headline --hash-memory=1024 -o=c:\osm\ready\garmin_odw_fire_hydrant_latest.csv --csv-separator=,
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_fire_hydrant.osm --all-to-nodes --csv="@lon @lat fire_hydrant:type fire_hydrant:diameter" --csv-headline --hash-memory=1024 -o=c:\osm\ready\garmin_oberzent_fire_hydrant_latest.csv --csv-separator=,


REM Hydranten erste Zeile löschen
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\garmin_odw_fire_hydrant_latest.csv
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\garmin_oberzent_fire_hydrant_latest.csv


REM Hydranten  doppelte ,, entfernen
C:\osm\tools\sed\bin\sed.exe -i "s/,,/,u,/g"  c:\osm\ready\garmin_odw_fire_hydrant_latest.csv
C:\osm\tools\sed\bin\sed.exe -i "s/,,/,u,/g"  c:\osm\ready\garmin_oberzent_fire_hydrant_latest.csv





REM AccessPoint export
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_access_point.osm --all-to-nodes --csv="@lon @lat ref name" --csv-headline --hash-memory=1024 -o=c:\osm\ready\garmin_oberzent_access_point_latest.csv --csv-separator=,
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_access_point.osm --all-to-nodes --csv="@lon @lat ref name" --csv-headline --hash-memory=1024 -o=c:\osm\ready\garmin_odw_access_point_latest.csv --csv-separator=,


REM AccessPoint erste Zeile löschen
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\garmin_oberzent_access_point_latest.csv
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\garmin_odw_access_point_latest.csv


REM AccessPoint  doppelte ,, entfernen
C:\osm\tools\sed\bin\sed.exe -i "s/,,/,u,/g"  c:\osm\ready\garmin_oberzent_access_point_latest.csv
C:\osm\tools\sed\bin\sed.exe -i "s/,,/,u,/g"  c:\osm\ready\garmin_odw_access_point_latest.csv




REM ################--CSV GARMIN erstellen--################ end








REM - - --- FIRESTATION ----------- start
c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\oberzent_fire_station.osm --all-to-nodes --csv="@id @lon @lat addr:housenumber addr:city addr:street addr:postcode name suburb" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_oberzent_fire_station.csv --csv-separator=;
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_oberzent_fire_station.csv
copy /b c:\osm\tools\odw_fire_station_firstline.txt+c:\osm\ready\tmp_oberzent_fire_station.csv c:\osm\ready\oberzent_fire_station.csv  

C:\osm\tools\sed\bin\sed.exe -i "/;;;;;;/d" c:\osm\ready\oberzent_fire_station.csv
C:\osm\tools\sed\bin\sed.exe -i "/;;Oberzent;;64760/d" c:\osm\ready\oberzent_fire_station.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Hirschhorn;/d" c:\osm\ready\oberzent_fire_station.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Mossautal;/d" c:\osm\ready\oberzent_fire_station.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Erbach;/d" c:\osm\ready\oberzent_fire_station.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Eberbach;/d" c:\osm\ready\oberzent_fire_station.csv



c:\osm\tools\osmconvert\osmconvert.exe c:\osm\temp\odw_fire_station.osm --all-to-nodes --csv="@id @lon @lat addr:housenumber addr:city addr:street addr:postcode name suburb" --csv-headline --hash-memory=24 -o=c:\osm\ready\tmp_odw_fire_station.csv --csv-separator=;
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_odw_fire_station.csv
copy /b c:\osm\tools\odw_fire_station_firstline.txt+c:\osm\ready\tmp_odw_fire_station.csv c:\osm\ready\odw_fire_station.csv  

C:\osm\tools\sed\bin\sed.exe -i "/;;;;;;/d" c:\osm\ready\odw_fire_station.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Hirschhorn;/d" c:\osm\ready\odw_fire_station.csv
C:\osm\tools\sed\bin\sed.exe -i "/;Eberbach;/d" c:\osm\ready\odw_fire_station.csv










REM - - --- FIRESTATION ----------- end




REM 1-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_odw_fire_hydrant.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_fire_hydrant_firstline.txt+c:\osm\ready\tmp_odw_fire_hydrant.csv c:\osm\ready\odw_fire_hydrant.csv


REM 1.1 - FÜR Google-Earth -----LÖSCHE ERSTE ZEILE AUS CSV------
copy /b c:\osm\tools\odw_fire_hydrant_kml_firstline.txt+c:\osm\ready\tmp_odw_fire_hydrant.csv c:\osm\ready\odw_fire_hydrant_kml.csv


REM 2-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_odw_water_tank.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_water_tank_firstline.txt+c:\osm\ready\tmp_odw_water_tank.csv c:\osm\ready\odw_water_tank.csv


REM 3-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_odw_fire_water_pond.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_fire_water_pond_firstline.txt+c:\osm\ready\tmp_odw_fire_water_pond.csv c:\osm\ready\odw_fire_water_pond.csv


REM 4-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_odw_suction_point.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_suction_point_firstline.txt+c:\osm\ready\tmp_odw_suction_point.csv c:\osm\ready\odw_suction_point.csv


REM 5-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_odw_access_point.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_access_point_firstline.txt+c:\osm\ready\tmp_odw_access_point.csv c:\osm\ready\odw_access_point.csv


REM 5.1 - FÜR Google-Earth -----LÖSCHE ERSTE ZEILE AUS CSV------
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_access_point_kml_firstline.txt+c:\osm\ready\tmp_odw_access_point.csv c:\osm\ready\odw_access_point_kml.csv

REM 6-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_odw_generator_solar.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_generator_solar_firstline.txt+c:\osm\ready\tmp_odw_generator_solar.csv c:\osm\ready\odw_generator_solar.csv

REM 1-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_oberzent_fire_hydrant.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_fire_hydrant_firstline.txt+c:\osm\ready\tmp_oberzent_fire_hydrant.csv c:\osm\ready\oberzent_fire_hydrant.csv

REM 1.1 - FÜR Google-Earth -----LÖSCHE ERSTE ZEILE AUS CSV------
copy /b c:\osm\tools\odw_fire_hydrant_kml_firstline.txt+c:\osm\ready\tmp_oberzent_fire_hydrant.csv c:\osm\ready\oberzent_fire_hydrant_kml.csv

REM 2-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_oberzent_water_tank.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_water_tank_firstline.txt+c:\osm\ready\tmp_oberzent_water_tank.csv c:\osm\ready\oberzent_water_tank.csv


REM 3-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_oberzent_fire_water_pond.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_fire_water_pond_firstline.txt+c:\osm\ready\tmp_oberzent_fire_water_pond.csv c:\osm\ready\oberzent_fire_water_pond.csv


REM 4-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_oberzent_suction_point.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_suction_point_firstline.txt+c:\osm\ready\tmp_oberzent_suction_point.csv c:\osm\ready\oberzent_suction_point.csv


REM 5-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_oberzent_access_point.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_access_point_firstline.txt+c:\osm\ready\tmp_oberzent_access_point.csv c:\osm\ready\oberzent_access_point.csv

REM 5.1 - FÜR Google-Earth -----LÖSCHE ERSTE ZEILE AUS CSV------
copy /b c:\osm\tools\odw_access_point_kml_firstline.txt+c:\osm\ready\tmp_oberzent_access_point.csv c:\osm\ready\oberzent_access_point_kml.csv


REM 6-----LÖSCHE ERSTE ZEILE AUS CSV------
C:\osm\tools\sed\bin\sed.exe -i 1D c:\osm\ready\tmp_oberzent_generator_solar.csv
REM Füge beide Dateien zusammen
copy /b c:\osm\tools\odw_generator_solar_firstline.txt+c:\osm\ready\tmp_oberzent_generator_solar.csv c:\osm\ready\oberzent_generator_solar.csv

REM del c:\osm\ready\tmp_odw_fire_hydrant.csv /s /q
REM del c:\osm\ready\tmp_odw_water_tank.csv /s /q
REM del c:\osm\ready\tmp_odw_fire_water_pond.csv /s /q
REM del c:\osm\ready\tmp_odw_suction_point.csv /s /q
REM del c:\osm\ready\tmp_odw_access_point.csv /s /q
REM del c:\osm\ready\tmp_odw_generator_solar.csv /s /q


del c:\osm\ready\tmp_oberzent_fire_hydrant.csv /s /q
del c:\osm\ready\tmp_oberzent_water_tank.csv /s /q
del c:\osm\ready\tmp_oberzent_fire_water_pond.csv /s /q
del c:\osm\ready\tmp_oberzent_suction_point.csv /s /q
del c:\osm\ready\tmp_oberzent_access_point.csv /s /q
del c:\osm\ready\tmp_oberzent_generator_solar.csv /s /q

REM ################--CSV erstellen--################

REM ################--GPX erstellen--################

c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_fire_hydrant.csv -o gpx -F c:\osm\ready\odw_fire_hydrant.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_water_tank.csv -o gpx -F c:\osm\ready\odw_water_tank.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_fire_water_pond.csv -o gpx -F c:\osm\ready\odw_fire_water_pond.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_suction_point.csv -o gpx -F c:\osm\ready\odw_suction_point.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_access_point.csv -o gpx -F c:\osm\ready\odw_access_point.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_generator_solar.csv -o gpx -F c:\osm\ready\odw_generator_solar.gpx

c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_fire_hydrant.csv -o gpx -F c:\osm\ready\oberzent_fire_hydrant.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_water_tank.csv -o gpx -F c:\osm\ready\oberzent_water_tank.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_fire_water_pond.csv -o gpx -F c:\osm\ready\oberzent_fire_water_pond.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_suction_point.csv -o gpx -F c:\osm\ready\oberzent_suction_point.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_access_point.csv -o gpx -F c:\osm\ready\oberzent_access_point.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_generator_solar.csv -o gpx -F c:\osm\ready\oberzent_generator_solar.gpx
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_fire_station.csv -o gpx -F c:\osm\ready\oberzent_fire_station.gpx

REM ################--GPX erstellen--################

REM ################--KML erstellen--################

c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_fire_hydrant.csv -o kml -F c:\osm\ready\odw_fire_hydrant.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_water_tank.csv -o kml -F c:\osm\ready\odw_water_tank.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_fire_water_pond.csv -o kml -F c:\osm\ready\odw_fire_water_pond.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_suction_point.csv -o kml -F c:\osm\ready\odw_suction_point.kml
REM c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_access_point.csv -o kml -F c:\osm\ready\odw_access_point.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_generator_solar.csv -o kml -F c:\osm\ready\odw_generator_solar.kml


c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_fire_hydrant.csv -o kml -F c:\osm\ready\oberzent_fire_hydrant.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_water_tank.csv -o kml -F c:\osm\ready\oberzent_water_tank.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_fire_water_pond.csv -o kml -F c:\osm\ready\oberzent_fire_water_pond.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_suction_point.csv -o kml -F c:\osm\ready\oberzent_suction_point.kml
REM c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_access_point.csv -o kml -F c:\osm\ready\oberzent_access_point.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_generator_solar.csv -o kml -F c:\osm\ready\oberzent_generator_solar.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_fire_station.csv -o kml -F c:\osm\ready\oberzent_fire_station.kml


REM -extra Zeile, da Namen in GoogleEarth sonst nicht richtig angezeigt werden-
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_access_point_kml.csv -o kml -F c:\osm\ready\odw_access_point.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_access_point_kml.csv -o kml -F c:\osm\ready\oberzent_access_point.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\odw_fire_hydrant_kml.csv -o kml -F c:\osm\ready\odw_fire_hydrant.kml
c:\osm\tools\gpsbabel\gpsbabel -w -i unicsv -f c:\osm\ready\oberzent_fire_hydrant_kml.csv -o kml -F c:\osm\ready\oberzent_fire_hydrant.kml

del c:\osm\ready\odw_access_point_kml.csv /s /q
del c:\osm\ready\oberzent_access_point_kml.csv /s /q
del c:\osm\ready\odw_fire_hydrant_kml.csv /s /q
del c:\osm\ready\oberzent_fire_hydrant_kml.csv /s /q
del c:\osm\ready\tmp_odw_water_tank.csv  /s /q
del c:\osm\ready\tmp_odw_fire_water_pond.csv	 /s /q
del c:\osm\ready\tmp_odw_generator_solar.csv /s /q
del c:\osm\ready\tmp_odw_suction_point.csv /s /q
del c:\osm\ready\tmp_odw_water_tank.csv /s /q
del c:\osm\ready\tmp_odw_fire_hydrant.csv /s /q
del c:\osm\ready\tmp_odw_access_point.csv /s /q
del c:\osm\ready\tmp_oberzent_fire_station.csv /s /q
del c:\osm\ready\tmp_oberzent_fire_station.csv /s /q


REM ################--KML erstellen--################













REM ################--GARMIN erstellen--################ start

copy odw-latest.pbf C:\osm\temp\

cd C:\osm\temp\
java -Xmx1024M -jar c:\osm\tools\splitter\splitter.jar --geonames-file=c:\osm\tools\cities15000.zip --mapid=10010001 C:\osm\temp\odw-latest.pbf
java -Xmx1024M -jar c:\osm\tools\mkgmap\mkgmap.jar --route --style-file=C:\osm\tools\mkgmap\style\ffw --add-pois-to-areas --country-abbr=DEU --family-name=FFWMAPODENWALDK --country-name=Germany --family-id=10010001 --index --gmapsupp C:\osm\temp\1001*.osm.pbf C:\osm\tools\mkgmap\style\ffw\ffw.TYP

ren odw-latest.pbf odw-latest.pbf.tmp
ren gmapsupp.img gmapsupp.img.tmp
del *.img /s /q
del *.args /s /q
REM del *.pbf /s /q
del *.list /s /q
del *.poly /s /q
del *.tdb /s /q
del *.txt /s /q
ren odw-latest.pbf.tmp odw-latest.pbf.osm.pbf
ren gmapsupp.img.tmp odw-latest.img
REM ---------------copy odw-latest.pbf.osm.pbf c:\osm\ready\odw-latest.osm.pbf
copy odw-latest.img c:\osm\ready\odw-latest.img
del *.img /s /q



copy oberzent-latest.pbf C:\osm\temp\

cd C:\osm\temp\
java -Xmx1024M -jar c:\osm\tools\splitter\splitter.jar --geonames-file=c:\osm\tools\cities15000.zip --mapid=10010000 C:\osm\temp\oberzent-latest.pbf
java -Xmx1024M -jar c:\osm\tools\mkgmap\mkgmap.jar --route --style-file=C:\osm\tools\mkgmap\style\ffw --add-pois-to-areas --country-abbr=DEU --family-name=FFWMAPOBZ --country-name=Germany --family-id=10010000 --index --gmapsupp C:\osm\temp\1001*.osm.pbf C:\osm\tools\mkgmap\style\ffw\ffw.TYP

ren oberzent-latest.pbf oberzent-latest.pbf.tmp
ren gmapsupp.img gmapsupp.img.tmp
del *.img /s /q
del *.args /s /q
del *.pbf /s /q
del *.list /s /q
del *.poly /s /q
del *.tdb /s /q
del *.txt /s /q
ren oberzent-latest.pbf.tmp oberzent-latest.pbf.osm.pbf
ren gmapsupp.img.tmp oberzent-latest.img
REM ---------------copy oberzent-latest.pbf.osm.pbf c:\osm\ready\oberzent-latest.osm.pbf
copy oberzent-latest.img c:\osm\ready\oberzent-latest.img

del *.img /s /q
del C:\osm\temp\*.* /s /q

REM ################--GARMIN erstellen--################ end


cd c:\osm\ready
ren oberzent-latest.img oberzent_latest.img
ren oberzent-latest.osm oberzent_latest.osm
ren oberzent-latest.pbf oberzent_latest.pbf
ren oberzent_access_point.csv oberzent_access_point_latest.csv
ren oberzent_access_point.gpx oberzent_access_point_latest.gpx
ren oberzent_access_point.kml oberzent_access_point_latest.kml
ren oberzent_access_point.osm oberzent_access_point_latest.osm
ren oberzent_fire_hydrant.csv oberzent_fire_hydrant_latest.csv
ren oberzent_fire_hydrant.gpx oberzent_fire_hydrant_latest.gpx
ren oberzent_fire_hydrant.kml oberzent_fire_hydrant_latest.kml
ren oberzent_fire_hydrant.osm oberzent_fire_hydrant_latest.osm
ren oberzent_fire_water_pond.csv oberzent_fire_water_pond_latest.csv
ren oberzent_fire_water_pond.gpx oberzent_fire_water_pond_latest.gpx
ren oberzent_fire_water_pond.kml oberzent_fire_water_pond_latest.kml
ren oberzent_fire_water_pond.osm oberzent_fire_water_pond_latest.osm
ren oberzent_generator_solar.csv oberzent_generator_solar_latest.csv
ren oberzent_generator_solar.gpx oberzent_generator_solar_latest.gpx
ren oberzent_generator_solar.kml oberzent_generator_solar_latest.kml
ren oberzent_generator_solar.osm oberzent_generator_solar_latest.osm
ren oberzent_suction_point.csv oberzent_suction_point_latest.csv
ren oberzent_suction_point.gpx oberzent_suction_point_latest.gpx
ren oberzent_suction_point.kml oberzent_suction_point_latest.kml
ren oberzent_suction_point.osm oberzent_suction_point_latest.osm
ren oberzent_water_tank.csv oberzent_water_tank_latest.csv
ren oberzent_water_tank.gpx oberzent_water_tank_latest.gpx
ren oberzent_water_tank.kml oberzent_water_tank_latest.kml
ren oberzent_water_tank.osm oberzent_water_tank_latest.osm
ren odw-latest.img odw_latest.img
ren odw-latest.osm odw_latest.osm
ren odw-latest.pbf odw-latest.pbf
ren odw_access_point.csv odw_access_point_latest.csv
ren odw_access_point.gpx odw_access_point_latest.gpx
ren odw_access_point.kml odw_access_point_latest.kml
ren odw_access_point.osm odw_access_point_latest.osm
ren odw_fire_hydrant.csv odw_fire_hydrant_latest.csv
ren odw_fire_hydrant.gpx odw_fire_hydrant_latest.gpx
ren odw_fire_hydrant.kml odw_fire_hydrant_latest.kml
ren odw_fire_hydrant.osm odw_fire_hydrant_latest.osm
ren odw_fire_water_pond.csv odw_fire_water_pond_latest.csv
ren odw_fire_water_pond.gpx odw_fire_water_pond_latest.gpx
ren odw_fire_water_pond.kml odw_fire_water_pond_latest.kml
ren odw_fire_water_pond.osm odw_fire_water_pond_latest.osm
ren odw_generator_solar.csv odw_generator_solar_latest.csv
ren odw_generator_solar.gpx odw_generator_solar_latest.gpx
ren odw_generator_solar.kml odw_generator_solar_latest.kml
ren odw_generator_solar.osm odw_generator_solar_latest.osm
ren odw_suction_point.csv odw_suction_point_latest.csv
ren odw_suction_point.gpx odw_suction_point_latest.gpx
ren odw_suction_point.kml odw_suction_point_latest.kml
ren odw_suction_point.osm odw_suction_point_latest.osm
ren odw_water_tank.csv odw_water_tank_latest.csv
ren odw_water_tank.gpx odw_water_tank_latest.gpx
ren odw_water_tank.kml odw_water_tank_latest.kml
ren odw_water_tank.osm odw_water_tank_latest.osm
ren tmp_oberzent_hausnummer.csv oberzent_hausnummer_latest.csv
ren tmp_odw_access_point.csv odw_access_point_latest.csv
ren tmp_odw_fire_hydrant.csv odw_fire_hydrant_latest.csv
ren tmp_odw_fire_water_pond.csv odw_fire_water_pond_latest.csv
ren tmp_odw_generator_solar.csv odw_generator_solar_latest.csv
ren tmp_odw_suction_point.csv odw_suction_point_latest.csv
ren tmp_odw_water_tank.csv odw_water_tank_latest.csv
ren oberzent_fire_station.csv oberzent_fire_station_latest.csv
ren oberzent_fire_station.gpx oberzent_fire_station_latest.gpx
ren oberzent_fire_station.kml oberzent_fire_station_latest.kml
ren oberzent_fire_station.osm oberzent_fire_station_latest.osm
ren oberzent_hausnummer.osm oberzent_hausnummer_latest.osm
ren tmp_odw_hausnummer.csv odw_hausnummer_latest.csv
ren odw_fire_station.osm odw_fire_station_latest.osm
ren odw-latest.pbf odw_latest_latest.pbf
ren odw_hausnummer.osm odw_hausnummer_latest.osm
ren odw_fire_station.csv odw_fire_station_latest.csv

del tmp_odw_fire_station.csv /s /q

copy c:\osm\ready\oberzent_latest.osm c:\osm\tools\Maperitive\oberzent_latest.osm

del C:\osm\temp\*.* /s /q
REM ------------------------------------------------------------------------------------------------------------------------------------------------------


REM - erstelle kreisweite Garmin-Karte
del c:\osm\ready\garmin\*.* /s /q
del c:\osm\ready\garmin\poi_hydrant\*.* /s /q
del c:\osm\ready\garmin\poi_ap\*.* /s /q


mkdir c:\osm\ready\garmin
copy c:\osm\ready\odw_latest.img c:\osm\ready\garmin\gmapsupp.img 


REM COPY 


mkdir c:\osm\ready\garmin\poi_hydrant
copy c:\osm\tools\garmin\poi_hydrant.bmp c:\osm\ready\garmin\poi_hydrant\
copy c:\osm\ready\garmin_odw_fire_hydrant_latest.csv c:\osm\ready\garmin\poi_hydrant\
ren c:\osm\ready\garmin\poi_hydrant\garmin_odw_fire_hydrant_latest.csv poi_hydrant.csv




mkdir c:\osm\ready\garmin\poi_ap
copy c:\osm\tools\garmin\poi_ap.bmp c:\osm\ready\garmin\poi_ap\
copy c:\osm\ready\garmin_odw_access_point_latest.csv c:\osm\ready\garmin\poi_ap\
ren c:\osm\ready\garmin\poi_ap\garmin_odw_access_point_latest.csv poi_ap.csv




pause


Zum Hintergrund:

Das Einsatzgebiet ist die Stadt Oberzent (oberzent.poly) im Landkreis Odenwaldkreis (odenwaldkreis.poly) in Hessen (hessen-latest.osm.pbf)
Zur Anpassung müssen die beiden .poly Dateien angepasst werden und das Bundesland.

Mir ist bewusst, dass man einige Stellen optimieren könnte, aber für meine Zwecke ist das Ergebnis ausreichend.

Wenn Du in dem Script noch beschreibst, wo Du die .poly herholst/ wie Du die erstellst, dann isses nahezu daukompatibel.

Was ich nicht ganz verstehe, warum bearbeitest Du odw und dann nochmal extra oberzent?

Die Poly wurde mit jsom erstellt – also selbst gemalt.

Die Erstellung von zwei Dateien macht Sinn für die spätere Verwendung:
Die große Datei vom kompletten Kreisgebiet (also die odw) ist auf einem Garmin Nüvi200 installiert – mit den Rettungspunkten als KML-Import.
Die wird für die Navigation im Waldbrandeinsatz genutzt – bisher glücklicherweise noch nicht benötigt.
Aus der kleinen oberzent-Datei (also die Gemeinde/Stadt) wird im nächsten Schritt mittels Maperative ein Tile-Set generiert, das zusammen mit Openlayers die Grundlage der Karte für das Tablet wird. Das reicht schon um eine Offline-Karte darzustellen. Mit Hilfe von weiteren Daten und einem lokalen Webserver kann dann eine Adressabfrage erfolgen, die die Entfernungen von Einsatzstelle zu den nächstgelegenen Hydranten darstellt.

Nauevi200

Tablet

Gleich zu Beginn erstellst Du zwei Verzeichnisse um in den nächsten Zeilen in den soeben erstellten Verzeichnissen Dateien zu löschen, wie kommen die Dateien so schnell da rein? Du hast doch die Verzeichnisse gerade erst erstellt.

Man kann auch Verzeichnisse incl. Inhalt silent löschen:


rd /s /q Deinverzeichnis\Unterverzeichnis

Ja aber massiv. Warum nicht einfach Overpass fragen statt sich mit hessen.pbf rumschlagen? Z.B. per:


wget 'http://overpass-api.de/api/interpreter?data=area%283607876002%29-%3E.searchArea%3B%0Anode%5B%22emergency%22%3D%22fire_hydrant%22%5D%28area.searchArea%29%3B%0Aout%20meta%3B' -O oberzent-hydrant.osm

Du hast recht - das ist unnötig. rd /s /q in Verbindung mit ifexist wäre eleganter.

Die Overpass-Abfrage klappt bei den nodes - da ich aber auch die komplette Karte für die Tiles und die Garmin-Karte benötige läuft overpass spätestens bei der Abfrage des kompletten Landkreises gegen die Wand weil die abgefragte Datenmenge zu groß wird.

Auf jeden Fall möchte ich lordronin danken, dass er hier eine praxiserpobte Konzeption vorstellt, die ja auch als Inspiration für ähnliche Anwendungen dienen kann! Wenn die Konzeption durch Ideen anderer noch weiter verbessert werden kann, ist das umso besser. :wink:

Ich hole das Thema noch Mal hoch.

Ich habe das Ganze Mal etwas optimiert.
Nach Aufruf der OFFLINEHYDRANT.cmd wird das Bundesland gewählt, danach die Postleitzahl der Gemeinde.
Mittel Poly-Datei und Maperitive wird ein Verzeichnis erstellt, welche eine Offlinekarte via Browser darstellt.
Die Programmierung ist sicherlich ausbaufähig, aber für´s Grobe oder als Grundlage für andere Projekte sollte das Ergebnis ausreichen.

Voraussetzungen
Das Verzeichnis “osmffw” muss direkt auf c:\ liegen

Aufruf
Die Datei OFFLINEHYDRANT.cmd aufrufen und den Anleitungen folgen

Download:
http://www.ffw-hetzbach.de/osm-offline-download/