[OSM-dev] Started coding (Altitude profile)

Sjors Provoost sjors at sprovoost.nl
Mon May 26 13:04:42 BST 2008


On Mon, May 26, 2008 at 10:02 PM, Ludwig <ludwigbrinckmann at gmail.com> wrote:
>> 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

Hi Ludwig,

Thanks for the tip: that sounds a *lot* better indeed!

Sjors




More information about the dev mailing list