Skip to content

Instantly share code, notes, and snippets.

@51114u9
Last active October 6, 2020 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 51114u9/960e38699cefaded949a32d403764698 to your computer and use it in GitHub Desktop.
Save 51114u9/960e38699cefaded949a32d403764698 to your computer and use it in GitHub Desktop.
Generate coordinate lines (lat & lon) for use in JOSM
#!/bin/sh
# Written by Vincent de Philly (https://help.openstreetmap.org/users/867/vincent-de-phily)
# Improved by Marco Antonio Frias
#
# This script was sugguest written in help forum to answer the question "Coordinate lines in josm?"
# https://help.openstreetmap.org/questions/9273/coordinate-lines-in-josm
file=gridlines.gpx
cat > $file << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<gpx creator="" version="1.1"
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<trk>
<name>Grid lines</name>
EOF
for i in $(seq -80 80); do
echo " <trkseg><trkpt lat=\"$i\" lon=\"-179\"></trkpt><trkpt lat=\"$i\" lon=\"180\"></trkpt></trkseg>" >> $file
done
for i in $(seq -179 180); do
echo " <trkseg><trkpt lat=\"80\" lon=\"$i\"></trkpt><trkpt lat=\"-80\" lon=\"$i\"></trkpt></trkseg>" >> $file
done
cat >> $file << EOF
</trk>
</gpx>
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment