[OSM-dev] Started coding (Altitude profile)

Ludwig ludwigbrinckmann at gmail.com
Mon May 26 13:02:49 BST 2008


>
> If big-endian signed integers ring a bell, I would be quite happy if
> you can take a quick look at this [1].
> [1]
> http://github.com/Sjors/srtm2postgis/tree/78c7d35c14b9c4f259248e80b3eaa59e25d0c8a2/test/test_read_data.py
> (or
> http://svn.openstreetmap.org/applications/utils/srtm2postgis/trunk/test/test_read_data.py
> )
>


Can I point you to the Geospatial Abstraction Data Library (GDAL) (
www.gdal.org), which has solved these problems and comes with a Python
binding and cooperates well with Python's numerical library (
http://numpy.scipy.org/)? There are different ways how to read the files,
but using the gdal_array interface has the big advantage of giving you
instantaneously a two-dimensional array.

Reading in your SRTM file can then be as easy as this:

from osgeo import gdal, gdal_array

srtm = gdal.Open('N19E096.hgt')
data = gdal_array.DatasetReadAsArray(srtm)

print data

HTH
Ludwig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20080526/ee10cb84/attachment.html>


More information about the dev mailing list