0

I have a large number of rasters (ca. 6000) representing species distributions that I would need to vectorize, to then do some analyses on the vectors in GRASS GIS. I would need to calculate the distance of the polygons to a set of points. For each vector point I need to find the nearest polygon and save the distance (so I'd use v.distance). I can vectorize the rasters in GRASS GIS using GDAL (which I found faster) using gdal_polygonize, but then if I save the vectors, they occupy a lot of memory (more than 600GB). I thought about creating them as in-memory vectors (but I've never done it, I'm just reading about it), vectorize them, do the analyses I need "on the go", and save just the output. Is this a good way or is there a more efficient one?

4
  • Good point. I would need to run v.distance to calculate distance of points to the polygons, but since the rasters have a very high resolution (100m), I could try r.distance. Not sure how computationally feasible is with big global rasters tho, but I could try. Commented Aug 7 at 19:26
  • "Best" questions are intrinsically opinion-based. Please do not ask subjective Questions. Commented Aug 7 at 19:59
  • Thanks, I have changed it to "most efficient" Commented Aug 8 at 8:32
  • 1
    I have added more details to the question. Commented Aug 8 at 9:36

1 Answer 1

2

This could work, depending on the structure of your data. If so you dont have to vectorize your rasters.

I have a raster with values: 1 (within species distribution), 0 (no species) and a point layer.

enter image description here

Create a proximity raster where you specify the target pixels as 1, and distance units = georeferenced coordinates. The output rasters values will be each pixels distance to nearest pixel with value 1.

Sample the raster values with the point layer to create a distance attribute on each point:

enter image description here

2
  • Thank you. How do you feel this solution can work for so many heavy rasters in QGIS? Maybe I'd need to try it with PyQGIS? Commented Aug 10 at 8:44
  • I dont know, you'll have to try it on a few. You can execute the model in batch, or create a python script. Commented Aug 10 at 16:01

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.