Skip to content

skwash/srtm2postgis

 
 

Repository files navigation

Script that imports the SRTM data in a PostGIS (PostgreSQL) database.  

http://wiki.openstreetmap.org/index.php/Route_altitude_profiles_SRTM#SRTM_import

NOTE: POSTGIS METHOD DOESN'T REALLY REQUIRE POSTGIS SINCE EVERYTHING IS INTEGER VALUES

Requires:
Python GDAL

Cassandra Requires:
 - pycassa (For Cassandra)

Postgres Requires:
 - psycopg2 (For Postgres/postgis)

Usage:
First run the tests that come with this script:

python test/test_download.py

Then download the SRTM source files (635 MB for Australia):

$ python download.py continent

(replace continent by Africa, Australia, Eurasia, Islands, 
North_America or South_America.

Argument 2-5 optionally specify a bounding box: north, south, west, east.

Verify that the download went correctly:

python test/verify_download.py continent

Create a PostGIS database (you may need to change some things here depending on 
your system):

$ createdb srtm
$ createlang plpgsql srtm
$ psql -d srtm -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
$ psql -d srtm -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql

Create a test database:

$ createdb srtm_test
$ createlang plpgsql srtm_test
$ psql -d srtm_test -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
$ psql -d srtm_test -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql

Run script that reads files and puts them in the database.
Test it first:

$ python test/test_read_data.py
$ python read_data_pg.py continent

Verify the result

$ python read_data_pg.py continent verify 

All altitude data should now be in the table 'altitude'. Enjoy.

About

Imports data from the NASA Shuttle Radar Topography Mission into a PostGIS database (and other databases in the futue).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.7%
  • Shell 0.3%