I am trying to understand how and if it is possible to get - extract the elevation value of a specific point (given x,y values) from a DEM layer in the GeoServer.

The only values that i am able to get back using the GetFeatureInfo is the following (example):

type    "FeatureCollection"
type    "Feature"
id  ""
geometry    null
GRAY_INDEX  -3.4028234663852886e+38
totalFeatures   "unknown"
numberReturned  1
timeStamp   "2022-06-23T10:29:05.858Z"
crs null

I have also check the following tutorial: [https://docs.geoserver.org/stable/en/user/tutorials/imagemosaic_timeseries/imagemosaic_time-elevationseries.html]

But again, i think that this is not exactly applied at my case.

  • 1
    Make a WCS request for the data rather than a WMS request for a picture of the data
    – Ian Turton
    Jun 23 at 12:11
  • If you have a try with the demo layer localhost:8080/geoserver/nurc/… you will get back the pixel values 98.0 114.0 81.0 255.0 for red, green, blue, and alpha. You got GRAY_INDEX -3.4028234663852886e+38 that feels like nodata to me. Check your GFI request.
    – user30184
    Jun 23 at 12:31
  • I will check the WCS request, thanks! Regarding the demo layer, i could see only RGB values, so maybe if the raster layer has the elevation value available will be displayed along with others? Jun 23 at 12:36
  • It is OK to use GetFeatureInfo for your query. The "mosaic" layer is RGBA and bad as a DEM example, sorry. But there is also a DEM example in the demo layers. localhost:8080/geoserver/sf/… return 1459.0.
    – user30184
    Jun 23 at 12:39
  • 1
    WMS GetFeatureInfo supports only query by point. For bbox query WCS is good even it requires some client side libraries to read the height values from a format like GeoTIFF. Depending on your use case asciigrid format could be easier to parse because it is plain text. If your aim is to get a height profile along a line then no existing OGC standard is rather handy for that. By reading smallish rectangles along the route with WCS and finding the heights at vertices of the line on the client side is doable.
    – user30184
    Jun 26 at 20:44


Your Answer

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

Browse other questions tagged or ask your own question.