Skip to content

Commit

Permalink
adds world-coutries target
Browse files Browse the repository at this point in the history
  • Loading branch information
bradoyler committed Sep 19, 2016
1 parent 03bc890 commit 02119cc
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Atlas-make - master makefile

TARGETS=na-places us-demographics us-towns us-cities us-states us-counties us-transportation us-congress
TARGETS=na-places us-demographics us-towns us-cities us-states us-counties us-transportation us-congress world-countries

all: ${TARGETS}

.PHONY: ${TARGETS}

world-countries:
cd $@ && make all

na-places:
cd $@ && make all

Expand Down Expand Up @@ -39,6 +42,7 @@ us-transportation:
us-congress:
cd $@ && make all


##-- deletes all files except gz/zip files -----
clean-all:
cd na-places && make clean-all
Expand All @@ -49,3 +53,4 @@ clean-all:
cd us-counties && make clean-all
cd us-transportation && make clean-all
cd us-congress && make clean-all
cd world-countries && make clean-all
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ this may take about 15mins, so try `$ make us-states` first
### Future plans:
- expand `us-demographics` data (Census & ACS)
- recipes for inserting data into PostgreSQL
- a `world-countries` target
- more `world-*` targets
- more map layers: roads, airports, etc.
- rendered map examples using [D3.js](https://d3js.org/) & [D3-Node](https://github.com/bradoyler/d3-node)

Expand Down
53 changes: 53 additions & 0 deletions world-countries/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# http://www.naturalearthdata.com/downloads/
# SCALES: 10m 50m 110m
BIN = ../node_modules/.bin
NATURAL_EARTH_CDN = http://naciscdn.org/naturalearth

all: topo/world-110m.json csv/world-countries.csv

.SECONDARY:

gz/ne_10m_%.zip:
mkdir -p $(dir $@)
curl "$(NATURAL_EARTH_CDN)/10m/cultural/ne_10m_$*.zip" -o $@.download
mv $@.download $@

gz/ne_50m_%.zip:
mkdir -p $(dir $@)
curl "$(NATURAL_EARTH_CDN)/50m/cultural/ne_50m_$*.zip" -o $@.download
mv $@.download $@

gz/ne_110m_%.zip:
mkdir -p $(dir $@)
curl "$(NATURAL_EARTH_CDN)/110m/cultural/ne_110m_$*.zip" -o $@.download
mv $@.download $@

# Admin 0 – countries (5.08M)
shp/ne_%_admin_0_countries.shp: gz/ne_%_admin_0_countries.zip
mkdir -p $(dir $@)
unzip -d shp $<
touch $@

# created w/ basic props, countries & land collection
topo/world-%.json: shp/ne_%_admin_0_countries.shp
mkdir -p $(dir $@)
$(BIN)/topojson \
--quantization 1e5 \
--properties name,type,abbrev,postal,pop_est,continent \
--id-property=+iso_n3 \
-- countries=shp/ne_$*_admin_0_countries.shp \
| $(BIN)/topojson-merge \
-o $@ \
--io=countries \
--oo=land \
--no-key

csv/world-countries.csv: shp/ne_110m_admin_0_countries.shp
mkdir -p $(dir $@)
rm -f $@
ogr2ogr -f 'CSV' -progress $@ $<

clean-all: clean/shp clean/topo clean/csv

clean/%:
rm -rf $(notdir $@)
13 changes: 13 additions & 0 deletions world-countries/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# World-Countries

Builds Shape, TopoJson & CSV files for all countries.

Data files are built from [Small](http://www.naturalearthdata.com/downloads/10m-cultural-vectors/), [Medium](http://www.naturalearthdata.com/downloads/50m-cultural-vectors/) & [Large](http://www.naturalearthdata.com/downloads/110m-cultural-vectors/) scale Cultural vectors from [Natural Earth](http://naturalearthdata.com/)


### Medium scale (1:50m)
`$ make topo/world-50m.json`
![50m-world](https://cloud.githubusercontent.com/assets/425966/18637913/12d2d6d6-7e5c-11e6-93a3-7f3d392c836f.png)

### Zoomed, showing data
![50m-world-zoomed](https://cloud.githubusercontent.com/assets/425966/18637669/2d8d6abe-7e5b-11e6-98c2-ab357fd405ef.png)

0 comments on commit 02119cc

Please sign in to comment.