maps.chandlerswift.com/layers/census-bureau/get_data.sh

18 lines
891 B
Bash
Raw Normal View History

2023-07-25 21:34:19 -05:00
#!/bin/sh
for resolution in 20m 5m; do
curl --silent --remote-name https://www2.census.gov/geo/tiger/GENZ2022/shp/cb_2022_us_county_${resolution}.zip
unzip cb_2022_us_county_${resolution}.zip
ogr2ogr -f GeoJSON us-counties-${resolution}.geojson cb_2022_us_county_${resolution}.shp
sed -i '/^"crs":/d' us-counties-${resolution}.geojson # TODO: handle this projection properly
rm cb_2022_us_county_${resolution}.*
# python cleanup_data.py us-counties-${resolution}.geojson # Only needed for KML files
done
curl --silent --remote-name https://www2.census.gov/geo/tiger/GENZ2022/shp/cb_2022_us_unsd_500k.zip
unzip cb_2022_us_unsd_500k.zip
ogr2ogr -f GeoJSON us-school-districts.geojson cb_2022_us_unsd_500k.shp
sed -i '/^"crs":/d' us-school-districts.geojson # TODO: handle this projection properly
rm cb_2022_us_unsd_500k.*
# TODO: some kind of cleanup to save space?