Created
October 8, 2014 20:27
-
-
Save lmullen/511643b0564f3aa5444a to your computer and use it in GitHub Desktop.
Mapping slavery starter kit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Makefile to re-project and simplify shapefiles. | |
SIMPLIFY_PERCENTAGE := 2.5 | |
REPROJECTION_CODE := EPSG:4326 | |
SIMPLIFIED := $(patsubst shp/%.shp, shp_out/%.shp, $(wildcard shp/*.shp)) | |
REPROJECTED := $(patsubst shp/%.shp, temp/%.shp, $(wildcard shp/*.shp)) | |
all : $(SIMPLIFIED) | |
.SECONDARY : $(REPROJECTED) | |
shp_out/%.shp : temp/%.shp | |
@echo "Simplifying $*" | |
mkdir -p shp_out | |
mapshaper $^ auto-snap -simplify $(SIMPLIFY_PERCENTAGE)% -o force $@ | |
temp/%.shp : shp/%.shp | |
@echo "Reprojecting $*" | |
mkdir -p temp | |
ogr2ogr -t_srs $(REPROJECTION_CODE) $@ $^ | |
clean : | |
rm -f temp/* | |
clobber : clean | |
rm -f shp_out/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment