Date
1 - 4 of 4
gdal_proximity
Spencer Gardner
Hi all. I'm using Rasterio for a raster analysis but I need to calculate proximity as is done in gdal_proximity. Is this implemented somewhere in Rasterio? I don't see anything like it in the docs. Or if not, is there a way to run the GDAL operation on the array? Or even better, I could run a numpy operation on it, but I'm not finding anything in numpy that is suitable. As an example, I am rasterizing a line feature that represents a segment of road. My analysis needs to account for proximity to the road such that cells touched by the road or immediately adjacent are weighted higher than roads that are 500 ft away. My intent with the proximity analysis was to use results to generate these weights. Any pointers are much appreciated. Thanks! Spencer
|
|
Anderson Roberto da Silva
Hello, First sorry for my bad English. Maybe I can help you and other people with the same doubt. Currently I' ve been working on a project that I need this functionality. def proximity(in_raster, out_raster, list_values=[]): For test: class TestProximity(unittest.TestCase): But first, you need to rasterize your roads. My function to this: def rasterize_fit_by_layer(geopackage, target_layer, field, grid_size, Change for your uses. Hope this helps. -- Anderson Roberto da Silva Engenheiro Cartógrafo
On Mon, Jan 4, 2021 at 5:21 PM Spencer Gardner <spencergardner@...> wrote:
|
|
Sean Gillies
Hi Spencer, On Mon, Jan 4, 2021 at 1:21 PM Spencer Gardner <spencergardner@...> wrote:
You're not overlooking anything. The rasterio project doesn't surface GDALComputeProximity. There are pointers to equivalent functionality in scipy at https://github.com/mapbox/rasterio/issues/531. Hope this helps, Sean Gillies
|
|
Spencer Gardner
Thanks. I'll give that a go.
On Wed, Jan 13, 2021 at 7:45 AM Sean Gillies <sean.gillies@...> wrote:
|
|