Created
April 19, 2016 07:03
-
-
Save wknowles/a1a90583ab3e97a4052504bb00d768c8 to your computer and use it in GitHub Desktop.
quick script to clip and re-project a shapefile
This file contains hidden or 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
#!/bin/bash | |
base_file='ne_50m_land' # change this to the filename of your shapefile | |
echo "clipping shapefile ${base_file}.shp" | |
ogr2ogr -f "ESRI Shapefile" ${base_file}_clipped.shp $base_file.shp -clipsrc -180 -85.06 180 85.06 | |
echo "setting ${base_file} to web mercator projection" | |
ogr2ogr -t_srs EPSG:3857 ${base_file}_clipped_3857.shp ${base_file}_clipped.shp | |
echo "cleaning up redundant files" | |
rm ${base_file}.* | |
rm ${base_file}_clipped.* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment