Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load US electronic navigation charts, for use in tile rendering
#!/bin/sh
HOST=localhost
USER=jesse
DATABASE=enc
wget http://inland.agc.army.mil/enc/echarts/catalog/iencu37productscatalog.xml
grep mode=0660 iencu37productscatalog.xml | sed s/\<location\>// | sed s/\<\\/location\>// | sed s/\&amp\;/\\\&/ | xargs wget wget --trust-server-names --user-agent="Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"
for i in *.zip; do unzip $i; done
psql -h $HOST postgres $USER -c "drop database $DATABASE"
psql -h $HOST postgres $USER -c "create database $DATABASE"
psql -h $HOST $DATABASE $USER -c "create extension postgis"
for i in ENC_ROOT/*/*.000; do ogr2ogr -t_srs EPSG:3857 -skipfailures -append -f "PostgreSQL" PG:"host=$HOST user=$USER dbname=$DATABASE" $i; done
#!/bin/sh
HOST=localhost
USER=jesse
DATABASE=enc
wget http://www.charts.noaa.gov/ENCs/All_ENCs.zip
unzip All_ENCs.zip
psql -h $HOST postgres $USER -c "drop database $DATABASE"
psql -h $HOST postgres $USER -c "create database $DATABASE"
psql -h $HOST $DATABASE $USER -c "create extension postgis"
export PGCLIENTENCODING=LATIN1
for i in ENC_ROOT/*/*.000; do ogr2ogr -t_srs EPSG:3857 -skipfailures -append -f "PostgreSQL" PG:"host=$HOST user=$USER dbname=$DATABASE" $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.