Skip to content

Commit

Permalink
used Mass.gov shape for RI Towns
Browse files Browse the repository at this point in the history
  • Loading branch information
bradoyler committed Sep 12, 2016
1 parent 9bf7a07 commit c6aaa06
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions us-towns/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ csv/%/countysubs.csv: shp/%/countysubs.shp
ogr2ogr -f 'CSV' -progress $@ $<

#### MA Towns via mass.gov #####
gz/ma_townssurvey_shp.zip:
gz/ma_towns.zip:
mkdir -p $(dir $@)
curl 'http://wsgw.mass.gov/data/gispub/shape/state/townssurvey_shp.zip' -o $@.download
mv $@.download $@

# extracts the TOWNSSURVEY_POLYM.* files from zip
shp/ma_towns/TOWNSSURVEY_POLYM.shp: gz/ma_townssurvey_shp.zip
shp/ma_towns/TOWNSSURVEY_POLYM.shp: gz/ma_towns.zip
rm -rf $(basename $@)
mkdir -p $(basename $@)
tar -xzm -C $(basename $@) -f $<
Expand All @@ -128,13 +128,43 @@ topo/ma/towns.json: geo/ma/towns.json
-o $@ \
-q 1e3 -s 1e-8 \
-p TOWN,TOWN_ID,POP2010,FIPS_STCO \
--id-property=+TOWN_ID \
-- towns=$<

csv/ma/towns.csv: shp/ma_towns/TOWNSSURVEY_POLYM.shp
mkdir -p $(dir $@)
rm -f $@
ogr2ogr -f 'CSV' -progress $@ $<

## RI Towns via Mass.gov

gz/ri_towns.zip:
mkdir -p $(dir $@)
curl 'http://wsgw.mass.gov/data/gispub/shape/ne/ritowns.zip' -o $@.download
mv $@.download $@

# extracts the RITOWNS_POLY.* files from zip
shp/ri_towns/RITOWNS_POLY.shp: gz/ri_towns.zip
rm -rf $(basename $@)
mkdir -p $(basename $@)
tar -xzm -C $(basename $@) -f $<
for file in $(basename $@)/$(basename $(notdir $@)).*; do chmod 644 $$file; mv $$file $(basename $@).$${file##*.}; done
rm -rf $(basename $@)

geo/ri/towns.json: shp/ri_towns/RITOWNS_POLY.shp
mkdir -p $(dir $@)
rm -f $@
ogr2ogr -f GeoJSON -t_srs EPSG:4326 $@ $<

topo/ri/towns.json: geo/ri/towns.json
mkdir -p $(dir $@)
../node_modules/.bin/topojson \
-o $@ \
-q 1e3 -s 1e-9 \
-p OSP_CODE,NAME,CFIPS_CODE,TFIPS_CODE \
--id-property=+OSP_CODE \
-- towns=$<

##### clean targets ##########
clean-all: clean/shp clean/geo clean/topo clean/csv

Expand Down

0 comments on commit c6aaa06

Please sign in to comment.