I need to interpolate the 3" srtm data for a game I'm developing (it's like Minecraft - voxel style). I downloaded the srtm data from viewfinderpanoramas.org. My aim is to get the height for every meter, so I'm tiling the world into 16x16m chunks so I have to perform 256 interpolations per chunk. For every block in a chunk I'm doing the interpolations like that:

  1. Calculate lat/lon for the block my chunk with the help of this post
  2. Calculate lat/lon for the 4 points q11 q12 q21 q22 which I need for my bilinear interpolation. You can see this calculation on the following picture. I'm add/sub 45m to each block's lat/lon because I want to find the nearest grid-point for each q11 q12 q21 q22 in my srtm-file. (the picture shows the calculation for the block in the top-left corner) enter image description here

  3. Then I'm searching the height data for q11 q12 q21 q22 in my srtm-file with the help of this post

  4. I'm performing my bilinear interpolation

The problem is, that my interpolated data looks like a heap of ruins but you can recognize the approximate terrain.

Can you tell me some hints or mistakes concerning my method?

Especially hints how I can get the 4 nearest grid points for the interpolation.

  • how about using an existing tool like GDALwarp gdal.org/gdalwarp.html to an appropriate zone/conic projection with -tr 1 1 -r bilinear, why bark if you've got a dog? Ideally you would use a cutline or GDAL_Translate gdal.org/gdal_translate.html with -projwin ulx uly lrx lry to create the boxes. You know that SRTM data isn't the best and that upsampling isn't really a good idea of course, but it's for a game - not for flying a UAV so it only needs to be reasonable. – Michael Stimson Feb 25 '15 at 4:06
  • Sorry, I'm new to geo data and gis. So I don't know what's "GDAL" is. For Europe, that's where I live, I guess SRTM data is the best I can get for free. What would you suggest for getting better upsampled data? – Vetterjack Feb 25 '15 at 20:22
  • Download GDAL or QGIS (which contains GDAL, and provides a great way to see your output). Both are open source. The tools are in the bin folder. SRTM is the best you can get for free, but only if you consider that it's global (fairly) uniform coverage; if you were to cut it down to a city or province you could perhaps get MUCH better data from the local government if you asked nicely (and signed some forms). However, it is important that you realize you can't cover the whole earth in metres without seams: en.wikipedia.org/wiki/Map_projection might help. – Michael Stimson Feb 25 '15 at 21:34

Browse other questions tagged or ask your own question.