Geographic Information Systems Asked by Nic Stray on July 31, 2021
I’m new to GIS and need to create a shortest path avoiding buildings. The buildings are represented as polygons in a shapefile.
In QGIS I created a buffer polygon for each building, corresponding the distance the path have to keep from the buildings. This polygons are overlapping each other a lot by every aglomeration of hauses.
My idea would be to rasterize this overlapping polygons into a DEM layer, so that:
the elevation value of each point
corresponds to the number of polygons overlapping over this point.
And having this, a least cost path algorithm would give me the wanted path.
But… the tools to merge polygons or for rasterization doesn’t helped yet.
Isn’t this the way how things like this are done? If not with QGIS, maybe with GeoTools or other software running under Linux?
EDIT: an Image to illustrate the problem
I have in mangenta the polygons representing buildings.
In red an approximation of the expected path.
In turquoise the bufferzones around the houses representing the minimal distance the path have to keep from the houses, if possible.
We see: it is impossible to avoid all bufferzones.
The path costs will increase for each buildig it is coming too close. If the path goes between one house and a group of two houses close together, it have to choose violate the buffer zone of the lonely house over the other.
How I’m trying to solve it: add the number of bufferzone polygons at each raster point to a DEM-Layer.
But maybe my approach isn’t ideal:
is there a way to create a DEM layer directly from the buildigs, defining a slope aroung them, summing up the slopes elevation values when they are overlapping?
Create a polygon-grid (squares) over you buffer polygons in the same size that you want your pixels to be (in my case: 1x1 meter). The extent of the grid should be the same as the buffer layer.
Than calculate how many buffers each grid-cell covers. You can do this calculating a new attribute with field calculator and an expression like this: array_length ( overlay_intersects( 'buffer', $id))
where buffer
is the name of your buffer layer (overlay_intersects
is available since QGIS 3.16). Depending on the extent, number of features, size of grid etc., this can quite take a while.
Now, based on this attribute value, you can rasterize the grid layer. You get a raster with the pixel value corresponding to the number of buffer-polygons that overlap at this point. Use the same pixel size as for the grid-cells and use the grid layer for the extent of the raster.
Screenshot 1: buildings (orange), overlapping buffer (blue), and grid with size 1x1 meter:
Screenshot 2: Close-up of the grid, labeled with the output of the array_length()
expression from above, corresponding to the no. of overlapping buffer-polygons:
Correct answer by Babel on July 31, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP