Book Image

Python Geospatial Analysis Cookbook

Book Image

Python Geospatial Analysis Cookbook

Overview of this book

Table of Contents (20 chapters)
Python Geospatial Analysis Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Other Geospatial Python Libraries
Mapping Icon Libraries
Index

Loading a DEM USGS ACSII CDED into PostGIS


Importing and working with a DEM in PostGIS is what this recipe is all about. We begin our journey with a text file that's full of points and is stored in the USGS ASCII CDED format (to read more about the details of this format, feel free to look at the documentation page at http://www.gdal.org/frmt_usgsdem.html). The ASCII format is well known and accepted by many desktop GIS applications as a direct data source. Feel free to simply open up your ASCII file with QGIS to view the files and see the resulting raster representation that it creates for you. Our task at hand is to import this DEM file into a PostGIS database, creating a new PostGIS raster dataset within PostGIS We perform this task by using a command-line tool called raster2pgsql, which is installed along with your PostGIS installation. The raster2pgsql tool is located on Windows under C:\Program Files\PostgreSQL\9.3\bin\ if you are running PostgreSQL 9.

Getting ready

Your data is available...