# How to extract the elevation from GeoTIFF at an arbitrary point in latitude/longitude?

I want to extract the elevation at any point in longitude/latitude from GeoTIFF, similar to Global Mapper. Using GDAL and rasterio, I get an image with a size of (6000, 6000) points. And the distance between each point, when translated into meters, is 90 meters, and I need a step between the points of 10 meters. Is it possible using raster libraries to get a result where the elevation is calculated based on the gradient of the raster, as Global Mapper does?

I use simple code:

``````from osgeo import gdal
import os
import geopy.distance

raster_band = gdal_data.GetRasterBand(1)
print(raster.size, raster.shape)
>>> 36000000 (6000, 6000)

width = gdal_data.RasterXSize
height = gdal_data.RasterYSize
i_x = 4315
i_y = 861
X = gt[0] + i_x*gt[1] + i_y*gt[2]
Y = gt[3] + i_x*gt[4] + i_y*gt[5]
Z = raster[i_y, i_x] # in array elevations
coords_1 = (54.282916666666665, 48.595416666666665)
coords_2 = (Y, X)
print (geopy.distance.geodesic(coords_1, coords_2).m)
>>> 92.75854901199543
``````

I need 10 meters instead of 90.

• Welcome to GIS SE. As a new user, please take the Tour. It is not possible to express a uniform conversion of degrees to meters, because all the meridians converge at the poles and even latitudes are not uniform due to oblateness. You can interpolate across three arc-second pixels, but the results are far from perfect. "Is it possible?" questions ask the wrong question -- what you really want is "How is it possible to..." We expect that your Question will include what you've tried. Sep 17, 2022 at 14:22
• Does this answer your question? Extracting data from a raster Sep 17, 2022 at 15:59
• I don't think this is a duplicate. The desired result seems to be an interpolation of Z values between cell centroids (e.g. 1, 2). Sep 18, 2022 at 9:35