[gdal-dev] Re: Reading height data from DEM files

İsmail Dönmez ismail at namtrac.org
Sun Jun 8 14:12:56 EDT 2008


Hi,

On Sun, Jun 8, 2008 at 7:56 PM, Oliver Eichler <oliver.eichler at gmx.de> wrote:
> On Sunday, 8. June 2008 18:39:42 İsmail Dönmez wrote:
>> On Thu, Jun 5, 2008 at 11:31 AM, İsmail Dönmez <ismail at namtrac.org> wrote:
>> > Hi all,
>> >
>> > I got DTED Level 0 map and I am trying to get the height profile
>> > between two points in the map. There are examples to get
>> > longitude/latitude of any point in the map but I can't see how I can
>> > find the height of a point. Any help or keywords for searching is
>> > appeciated.
>>
>> Replying to myself I think RasterIO is what I need. Any confirmation
>> on this would be great.
>
> Hi Ismail,
>
> yes, you have to get the 4 points close to your wanted point via RasterIO and
> interpolate.

Since I have to calculate elevation for all points in dted file, I
tried something like this:

>>> from osgeo import gdal
>>> f = gdal.Open("n30.dt0")
>>> f.ReadAsArray()

array([[  0,   0,   0, ...,  76,  75,  77],
       [  0,   0,   0, ...,  54,  57,  59],
       [  0,   0,   0, ...,  62,  60,  63],
       ...,
       [ 18,  17,  16, ..., -28, -28, -19],
       [ 22,  17,  17, ..., -21, -19, -27],
       [ 20,  16,  14, ..., -29, -27, -38]], dtype=int16)

So in the final array, array [x][y] would give me elevation data for
(x,y) coordinates (relative to the dted file), am I correct?

Thanks,
ismail


-- 
Never learn by your mistakes, if you do you may never dare to try again.


More information about the gdal-dev mailing list