-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetchAndCombinePopPlace.sh
executable file
·35 lines (29 loc) · 1.47 KB
/
fetchAndCombinePopPlace.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
## OPENSTREETMAP
# Get the osm for populated places in the world
# This could be done in one wget but seperate steps are nicer
wget -O cities.osm 'http://overpass-api.de/api/interpreter?data=[timeout:3600];node[place="city"];out;'
wget -O towns.osm 'http://overpass-api.de/api/interpreter?data=[timeout:3600];node[place="town"];out;'
wget -O villages.osm 'http://overpass-api.de/api/interpreter?data=[timeout:3600];node[place="village"];out;'
wget -O hamlets.osm 'http://overpass-api.de/api/interpreter?data=[timeout:3600];node[place="hamlet"];out;'
wget -O isolated.osm 'http://overpass-api.de/api/interpreter?data=[timeout:3600];node[place="isolated_dewlling"];out;'
# Merge the resulting files into one
chmod +x osmconvert64
./osmconvert64 cities.osm towns.osm villages.osm hamlets.osm isolated.osm -o=PopPlacesOsm.osm
rm cities.osm towns.osm villages.osm hamlets.osm isolated.osm
## NGA
# pull latest version of NGA country data
wget -r -l1 -A 'geonames_fc_*.zip' -nH --cut-dirs 3 'ftp://ftp.nga.mil/pub2/gns_data/' -O 'nga.zip'
# unzip it
unzip nga.zip
rm nga.zip
# convert it to OSM format; this script is configured to look for a file called Countries_populatedplaces_p.txt and output a file called nga.osm
perl gns2osm.pl
# delete remaining NGA data
rm *.txt
## Add other data sources here...
# Combine the two data sources (no deduping or merging)
echo 'Merging into one file...'
./osmconvert64 nga.osm PopPlacesOsm.osm -o=PopPlaces.osm
rm PopPlacesOsm.osm nga.osm
echo 'Done'