User:Aighes/Create Grid
Jump to navigation
Jump to search
Für alle, die es interessiert hab ich mal eine batch-Datei geschrieben, die ein Gitter mit ganzzahligem Gitterabstand in eine OSM-Datei schreibt. Getaggt werden die Linien mit grid:longitude=<Gradzahl> bzw. grid:latitude=<Gradzahl>. Die ID's beginnen bei -1 und enden mit -1617.
ECHO ^<?xml version='1.0' encoding='UTF-8'?^> > grid.osm
ECHO ^<osm version='0.6' generator='JOSM'^> >> grid.osm
set /a i=0
set /a j=1
ECHO ^<node id='-%j%' visible='true' lat='%i%.0' lon='180.0' /^> >> grid.osm
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='%i%.0' lon='-179.9999999999999' /^> >> grid.osm
:start
if /I %i% GEQ 89 goto :next
set /a i=%i%+1
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='%i%.0' lon='180.0' /^> >> grid.osm
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='%i%.0' lon='-179.9999999999999' /^> >> grid.osm
goto :start
:next
set /a i=0
:start1
if /I %i% GEQ 89 goto :next1
set /a i=%i%+1
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='-%i%.0' lon='180.0' /^> >> grid.osm
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='-%i%.0' lon='-179.9999999999999' /^> >> grid.osm
goto :start1
:next1
set /a j=%j%+1
ECHO ^<way id='-%j%' visible='true'^> >> grid.osm
ECHO ^<nd ref='-1' /^> >> grid.osm
ECHO ^<nd ref='-2' /^> >> grid.osm
ECHO ^<tag k='grid:latitude' v='0' /^> >> grid.osm
ECHO ^</way^> >> grid.osm
set /a i=2
set /a k=0
:start2
if /I %i% GEQ 180 goto :next2
set /a i=%i%+1
set /a j=%j%+1
set /a k=%k%+1
ECHO ^<way id='-%j%' visible='true'^> >> grid.osm
ECHO ^<nd ref='-%i%' /^> >> grid.osm
set /a i=%i%+1
ECHO ^<nd ref='-%i%' /^> >> grid.osm
ECHO ^<tag k='grid:latitude' v='%k%' /^> >> grid.osm
ECHO ^</way^> >> grid.osm
goto :start2
:next2
set /a i=180
set /a k=0
:start3
if /I %i% GEQ 358 goto :next3
set /a i=%i%+1
set /a j=%j%+1
set /a k=%k%+1
ECHO ^<way id='-%j%' visible='true'^> >> grid.osm
ECHO ^<nd ref='-%i%' /^> >> grid.osm
set /a i=%i%+1
ECHO ^<nd ref='-%i%' /^> >> grid.osm
ECHO ^<tag k='grid:latitude' v='-%k%' /^> >> grid.osm
ECHO ^</way^> >> grid.osm
goto :start3
:next3
----------
set /a i=0
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='89.0' lon='%i%.0' /^> >> grid.osm
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='-89.0' lon='%i%.0' /^> >> grid.osm
:start4
if /I %i% GEQ 180 goto :next4
set /a i=%i%+1
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='89.0' lon='%i%.0' /^> >> grid.osm
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='-89.0' lon='%i%.0' /^> >> grid.osm
goto :start4
:next4
set /a i=0
:start5
if /I %i% GEQ 179 goto :next5
set /a i=%i%+1
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='89.0' lon='-%i%.0' /^> >> grid.osm
set /a j=%j%+1
ECHO ^<node id='-%j%' visible='true' lat='-89.0' lon='-%i%.0' /^> >> grid.osm
goto :start5
:next5
set /a j=%j%+1
ECHO ^<way id='-%j%' visible='true'^> >> grid.osm
ECHO ^<nd ref='-538' /^> >> grid.osm
ECHO ^<nd ref='-539' /^> >> grid.osm
ECHO ^<tag k='grid:longitude' v='0' /^> >> grid.osm
ECHO ^</way^> >> grid.osm
set /a i=539
set /a k=0
:start6
if /I %i% GEQ 899 goto :next6
set /a i=%i%+1
set /a j=%j%+1
set /a k=%k%+1
ECHO ^<way id='-%j%' visible='true'^> >> grid.osm
ECHO ^<nd ref='-%i%' /^> >> grid.osm
set /a i=%i%+1
ECHO ^<nd ref='-%i%' /^> >> grid.osm
ECHO ^<tag k='grid:longitude' v='%k%' /^> >> grid.osm
ECHO ^</way^> >> grid.osm
goto :start6
:next6
set /a i=899
set /a k=0
:start7
if /I %i% GEQ 1257 goto :next7
set /a i=%i%+1
set /a j=%j%+1
set /a k=%k%+1
ECHO ^<way id='-%j%' visible='true'^> >> grid.osm
ECHO ^<nd ref='-%i%' /^> >> grid.osm
set /a i=%i%+1
ECHO ^<nd ref='-%i%' /^> >> grid.osm
ECHO ^<tag k='grid:longitude' v='-%k%' /^> >> grid.osm
ECHO ^</way^> >> grid.osm
goto :start7
:next7
ECHO ^</osm^> >> grid.osm