Last active
June 11, 2020 00:36
-
-
Save diegovalle/5864549 to your computer and use it in GitHub Desktop.
Revisions
-
diegovalle revised this gist
Jun 28, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,6 +24,7 @@ # sudo apt-get install innoextract # chmod +x download-mapa-digital-shp.sh # If you use a mac you should probably 'brew install wget' first # The script will create a directory called 'mapa_digital' where all # the shapefiles are located, if something goes wrong when dowloading # be sure to delete it and try again -
diegovalle revised this gist
Jun 27, 2013 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,15 @@ # Purpose: Download the shapefiles contained in the Mapa Digital de México # comunicaciones y transportes # cultura # curvas de nivel # hidrografia # infraestructura # marco cartografico nacional # rasgo orografico # territorio insular # Note that you'll need a recent version of innoextract # http://constexpr.org/innoextract/, one that can work with files # created by version 5.5 of Inno Setup, the one in Ubuntu universe is -
diegovalle revised this gist
Jun 26, 2013 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,10 +15,9 @@ # sudo apt-get install innoextract # chmod +x download-mapa-digital-shp.sh # The script will create a directory called 'mapa_digital' where all # the shapefiles are located, if something goes wrong when dowloading # be sure to delete it and try again # Projection compatible with Google Maps PROJECTION="+proj=longlat +ellps=WGS84 +no_defs +towgs84=0,0,0" @@ -37,7 +36,7 @@ done echo "Extracting shapefiles..." innoextract --lowercase --silent instalador_proyecto_informacion_basica.exe echo "Reprojecting shapefiles..." find . -name '*.shp' -execdir ogr2ogr {} {} -overwrite -t_srs "$PROJECTION" \; mv "app/proyecto de informacion basica" "mapa_digital" rm -rf app rm -rf tmp -
diegovalle revised this gist
Jun 26, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ # As of now, this script has not been tested on Windows and Mac # systems, only on Ubuntu. The script will create a directory # called 'mapa_digital' where all the shapefiles are located, if something # goes wrong when dowloading be sure to delete it and try again # Projection compatible with Google Maps -
diegovalle revised this gist
Jun 26, 2013 . No changes.There are no files selected for viewing
-
diegovalle created this gist
Jun 26, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #! /bin/bash # Author: Diego Valle-Jones # Web: http://www.diegovalle.net # Purpose: Download the shapefiles contained in the Mapa Digital de México # Note that you'll need a recent version of innoextract # http://constexpr.org/innoextract/, one that can work with files # created by version 5.5 of Inno Setup, the one in Ubuntu universe is # not recent enough. The version available at # https://launchpad.net/~arx/+archive/release is good enough. # sudo add-apt-repository ppa:arx/release # sudo apt-get update # sudo apt-get install innoextract # chmod +x download-mapa-digital-shp.sh # As of now, this script has not been tested on Windows and Mac # systems, only on Ubuntu. The script will create a directory # called 'shps' where all the shapefiles are located, if something # goes wrong when dowloading be sure to delete it and try again # Projection compatible with Google Maps PROJECTION="+proj=longlat +ellps=WGS84 +no_defs +towgs84=0,0,0" # wget command WGET="wget -w 5 --random-wait --tries=2 " # The mapa digital is available as 4 files declare -a extensions=(".exe" "-1.bin" "-2.bin" "-3.bin") for i in {0..3} do $WGET "http://www.inegi.org.mx/geo/contenidos/mapadigital/default.aspx?_file=/geo/contenidos/MapaDigital/exe/Instalador_Proyecto_informacion_basica${extensions[i]}&idusr=80085" -O instalador_proyecto_informacion_basica${extensions[i]} sleep 20 done echo "Extracting shapefiles..." innoextract --lowercase --silent instalador_proyecto_informacion_basica.exe echo "Reprojecting shapefiles..." find . -maxdepth 8 -name '*.shp' -execdir ogr2ogr {} {} -overwrite -t_srs "$PROJECTION" \; mv "app/proyecto de informacion basica" "mapa_digital" rm -rf app rm -rf tmp rm -rf instalador_proyecto_informacion_basica*