When reading COG (Cloud Optimized GeoTIFF) or original GeoTIFF of a DEM/DTM (elevation map) file using Geotiff.js directly or geoblaze, elevation at a point through conversion of coordinates to pixels, it is returning null.

I'm getting the coordinates from QGIS by copying coordinates(-79.57667578, 8.89886421) (projection EPSG: 32617) at a point inside the DEM. QGIS is able to give elevation correctly at that point.

Although, it works in some sample DEM files retrieved from the internet, and shows correct elevation, I'm not sure why some seem to have issues. The rasters having issues also seem to have high x, y pixel values on conversion from coordinates, whereas the ones in which elevation is working it seems to be just 2-3 digits long.

For one raster - EPSG:32617 is the Projection. The [lon,lat] array I'm passing to geoblaze.identify(docs.geoblaze.io/#identify) is [-79.57667578, 8.89886421] which returns null.


const point = [-79.57667578, 8.89886421];

const results = await geoblaze.identify(signedurl, point);

console.log("Identify", point, "Value", results);

Prints - Identify [ -79.57667578, 8.89886421 ] Value null

Using geotiff.js directly and converting the above lat lng to pixel coordinates gives Px,Py as -6563580,9844235 and this returns 0 as the value when trying to read a 1x1 window from above pixel value in raster.


const widthPct = (longitude - bbox[0]) / bboxWidth; 
const heightPct = (latitude - bbox[1]) / bboxHeight; 
const xPx = Math.floor(pixelWidth * widthPct); 
const yPx = Math.floor(pixelHeight * (1 - heightPct)); 

const window = [xPx, yPx, xPx + 1, yPx + 1];
const data = await image.readRasters({ window });

console.log("Value", xPx, yPx, data);

Prints - Value -6563580 9844235 [ Float32Array(1) [ 0 ], width: 1, height: 1 ]

Unable to figure out what's causing this issue.

  • I have edited the question to include the necessary information Commented Jun 8, 2023 at 9:16

1 Answer 1


Turns out, the projection of the coordinates I was giving as input was wrong. While in QGIS, the projection system seemed to be different in the status bar, on changing that to the correct one and then copying coordinates at a point, it worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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