Skip to content

Instantly share code, notes, and snippets.

@DylanMoriarty
Created May 18, 2019 17:40
Show Gist options
  • Save DylanMoriarty/d419d57b03f326d8dd4dd81c27ae3763 to your computer and use it in GitHub Desktop.
Save DylanMoriarty/d419d57b03f326d8dd4dd81c27ae3763 to your computer and use it in GitHub Desktop.
CC2 – Working Makefile Example
# Any lines that begin with a pound sign like this one are "commented out."
# That means they are skipped by the computer when it reads this file.
# This can be useful for leaves notes for yourself, or others!
echo-caynon:
echo "don't have a cow homer!"
echo "don't have a cow homer!!"
echo "don't have a cow homer!!!"
pandaMap:
mapshaper countries.json \
-join native-red-pandas.csv keys=NAME,COUNTRY \
-filter '"yes".indexOf(PANDAS) > -1' \
-clean \
-proj +init=EPSG:32645 \
-o countries-with-pandas.json
echo "finished"
#
# Your super solid California Wildfire Makebots can be written below!
#
fetch:
curl -O "https://rmgsc.cr.usgs.gov/outgoing/GeoMAC/2018_fire_data/current_year_all_states/2018_perimeters_dd83.zip"
unzip:
@[ -d data ] || mkdir data
unzip -o "2018_perimeters_dd83.zip" -d data/
rm 2018_perimeters_dd83.zip
filter:
Mapshaper data/2018_perimeters_dd83.shp \
-filter '"CA".indexOf(state) > -1' \
-o data/perimeters_filtered.shp
dissolve:
Mapshaper data/perimeters_filtered.shp \
-dissolve2 incidentna \
-o data/perimeters_dissolved.shp
clip:
mapshaper data/perimeters_dissolved.shp \
-clip California.geojson \
-o format=geojson data/perimeters_clipped.json
clean:
rm -rf data
wildfire-factory:
make clean
make fetch
make unzip
make filter
make dissolve
make clip
# ----------------
#
# Building Fetcher
#
# ----------------
getFootprints:
@[ -d data ] || mkdir data
curl -O https://usbuildingdata.blob.core.windows.net/usbuildings-v1-1/$(STATE).zip
unzip $(STATE).zip -d data/
node --max-old-space-size=8192 `which mapshaper` data/$(STATE).geojson -o format=shapefile data/$(STATE).shp
rm data/$(STATE).geojson
rm data/$(STATE).zip
largerFile:
ogr2ogr -nlt POLYGON -skipfailures $(STATE).shp $(STATE).geojson OGRGeoJSON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment