-2

I'm starting on a problem where I need to find the high point inside a polygon that exists inside the bounds of a DEM tile. I'm teaching myself GDAL and I'll be using Python to access the GDAL library. I've see Zonal Statistics, but isn't quite what I need. I need the elevation, AND longitude, latitude.

My impression is that I need to INTERSECT the polygon with the raster tile (ArcGrid, Geotiff) and extract an array of points (x,y,z) from the DEM. Then analyze the array of points.

In my learning, I need to figure out how to put these words into commands.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Thomas
  • 7
  • 1
  • Check out the raster package in R e.g. https://rspatial.org/spatial/8-rastermanip.html#accessing-cell-values – mdsumner Jun 04 '19 at 15:30
  • Do you have any programming experience? Python, R, C, Perl? Any GIS experience? ArcGIS, QGIS? What's our starting point here? – Spacedman Jun 04 '19 at 15:43
  • Thank you for holding my feet to the fire on narrowing the question. Is it now time to take it off hold? Or am I still sitting in the corner? – Thomas Jun 07 '19 at 19:45
  • What have you tried and where are you stuck? Including a single question mark appropriately in your question body is I think the best way to start improving your question. – PolyGeo Jun 07 '19 at 21:37
  • The issue is pretty clear. – Thomas Jun 10 '19 at 13:06

2 Answers2

1

You are trying to clip a raster using a mask layer. Using Qgis, you can follow the following procedure.

  1. Load your dem and polygon on the canvas

  2. In the raster menu, go to Extraction -> Clip raster by mask layer

  3. There, put your DEM as input layer, your polygon as mask layer. You can pretty much leave the other fields as default

  4. In the Clipped(mask) field, select the place you want to save the results to (Save to file), select the file extension .xyz

You should be able to read the resulting file either in Qgis, Excel or another software depending on your needs.

Kantan
  • 1,917
  • 2
  • 14
  • 26
0

This is possible, and not very complicated in most GIS software. The best way to learn it will be to figure out which tools/algorithms will be used, and find the relevant section of the software manual. If the manual doesn't have enough detail, find tutorials for those tools in your chosen software by using the name of the software and the name of the tool as search terms. Once you pick a software, you may find that the question has already been answered for that software on GIS StackExchange.

The operation will most likely be performed in two or three steps:

  1. Clip / intersect the raster to the polygon. Since rasters are always rectangular, the output of this step will be a rectangular raster with a "border" of nodata cells.
  2. Extract the raster values as points
  3. Depending on how the software handles the "no data" part of the raster, your output from step 2 may have points with "no data" values, which will need to be removed. You can handle this by running a clip or intersect operation (this will be a different tool/algorithm than used in step one, because the input layers are both vectors), or by selecting and deleting all points with "no data" values.

Eg, in QGIS, those steps would be:

  1. Use the tool Clip raster by mask layer or Clip raster with polygon. (Relevant section of the QGIS Manual).
  2. Raster pixels to points tool, or see this SE Q&A: How to convert raster to point in QGIS
  3. Use Intersection tool (relevant section of manual) if you want to copy attributes from the polygon to the points. Otherwise, use the Clip tool (relevant section of manual).
csk
  • 24,827
  • 3
  • 32
  • 70
  • You understand the issue that I'm discussing..you must have a basic level of literacy. The tool I'll be using is Python/GDAL. This place seems to be for real techno-snobs. – Thomas Jun 10 '19 at 13:09