0

I am using qgis to create a raster elevation image (png) from SRTM data. I need to create a png via qgis which I will then query to determine the rgb of particular pixels via php. How do I define a color scheme within qgis in a way that I can then use the same gradient to calculate the elevation of the pixel from the png?

1

To be honest that is not a good way to do it.

But if you must then you could encode the value of the dem in the R (or G or B) element of the image by calculating 256*(value/maxValue). Your Php code could then reverse the calculation as maxvalue*(pixel/256).

  • Thanks. I need to determine elevations between 0 and 5000m so 256 colours would give me 19m intervals which I guess is the resolution of th SRTM data so that would work I guess. So I just choose multiband colour from the style section of the layer property? – TomH Mar 17 '18 at 11:58
  • better to use a 32bit tiff and read out directly – Ian Turton Mar 17 '18 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.