[gdal-dev] Dissolve large amount of geometries
Even Rouault
even.rouault at spatialys.com
Thu Jun 28 04:25:14 PDT 2018
On jeudi 28 juin 2018 12:53:27 CEST Paul Meems wrote:
> Hi list,
>
> I've been working on this for months (off and on) and still no satisfying
> outcome.
> Either the process takes too long (multiple hours) or the result has
> invalid geometries.
>
> I want to try a different angle now. Instead of asking technical questions
> I want to explain what I try to do. Hopefully, somebody has a
> suggestion/hint which gives me some new insights.
>
> I have a high-resolution geotiff (drone image). And I need to create a
> taskmap in shapefile format.
> This taskmap is used in the tractor (precision farming) for variable
> spraying crop protection agents or variable fertilization using GPS, etc.
>
> The user starts by giving the precision (width and height) of the taskmap.
> I then create a fishnet over the tiff using the given width and height.
> Typical values can 1 by 1 meter or less. This results in a dataset with a
> lot of square/rectangles (1.5 - 2 million). Next step is to rotate the
> fishnet to align with the tractor path and clip with the field border. Then
> for each geometry, I get the pixel values from the tiff inside the
> geometry. I calculate the average and add this value as 'Rating' to the
> geometry.
> This process is fast enough, about 20-30 seconds.
>
> Next step is the slow part.
> I need to merge the adjacent geometries with the same rating. Multipolygons
> are not needed. If created I will break them apart later.
>
> Of course, I tried using GDAL+GEOS and the result seems OK, but it takes
> hours to finish.
>
> Reading my long description, how would you handle this challenge?
> I'm open to any suggestion.
What about rotating your raster so that the fishnet is horizontal/vertical
lines in that rotated raster ? Then you could clip, resample it to desired
resolution. And you would use gdal_polygonize, which would merge the cells of
same value quickly
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list