This question already has an answer here:

I'm using Leaflet map + GeoServer to display a map. I have a TIFF file and a DTED level 2 file.

I created a GeoTIFF store and layer that i'm showing in Leaflet, And I created a DTED store and layer in GeoServer.

I want now to display the altitude of each point from the DEM Layer, like so:

Latitude: 32.123 ,longitude: 12.112, Altitude: 12312 m

How do I get the altitude data from the store I created?

I tried using WCS protocol but I only get images.

marked as duplicate by Ian Turton geoserver Nov 12 at 8:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You can publish the DEM as WMS, and use the GetFeatureInfo request to retrieve its value at a given coordinate. This method was described here already.

Alternatively it might be more efficient to publish a GeoTIFF, if the DEM is small or the amount of values to be requested is high. When you serve the DEM as GeoTIFF you could use the leaflet-geotiff plugin to extract the raster value at a given coordinate:

var map = L.map('map');
var dem = L.leafletGeotiff(url).addTo(map);

map.on('click', function(e) {
  var elevation = dem.getValueAtLatLng(e.latlng.lat,e.latlng.lng);
}

Note that currently only GeoTIFFs in EPSG:4326 are supported.

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