Skip to content

Instantly share code, notes, and snippets.

@Dante383
Created July 17, 2019 04:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dante383/bf5c3678795fa0ccc2b6afa01c40f7ce to your computer and use it in GitHub Desktop.
Save Dante383/bf5c3678795fa0ccc2b6afa01c40f7ce to your computer and use it in GitHub Desktop.
OSM: get all street names with coordinates
#!/bin/bash
if [[ $# -eq 0 || $# -eq 1 ]] ; then
echo 'Usage: ./get_streets.sh input_file.osm output_file.csv'
exit 0
fi
# convert .osm to .o5m
osmconvert $1 -o=temp.o5m
osmfilter temp.o5m --keep="highway=residential =primary =secondary =tertiaty=unclassified" --drop-author --drop-version > temp.osm
rm temp.o5m
osmconvert temp.osm --all-to-nodes --csv="@lat @lon name" --csv-headline > temp.csv
rm temp.osm
awk '$3!=""' temp.csv > $2
rm temp.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment