Skip to content

Instantly share code, notes, and snippets.

@nautilytics
Last active July 28, 2020 16:46
Show Gist options
  • Save nautilytics/c870545c7d4ab42c6c1a24bfa1c51948 to your computer and use it in GitHub Desktop.
Save nautilytics/c870545c7d4ab42c6c1a24bfa1c51948 to your computer and use it in GitHub Desktop.
Retrieve place names with population (.e00) and put into a Postgres database
# Retrieve data from https://water.usgs.gov/GIS/metadata/usgswrd/XML/places.xml#stdorder
# curl https://water.usgs.gov/GIS/dsdl/places.e00.gz
# put the data into "Web Mercator" projection
PRJ="EPSG:4326"
DB=gis_db
# The original files were coverages, so I have to know something about
# what I want to transfer. For example for this file I want only LAB
# ogrinfo places.e00
# 1: LAB (Point) This is the one I want.
# Load the contents of the file into the "places" table
ogr2ogr -t_srs $PRJ -f PostgreSQL \
PG:"user=postgres dbname=$DB" \
places.e00 LAB \
-lco GEOMETRY_NAME=the_geom -nln places
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment