[gdal-dev] Dissolve large amount of geometries

Paul Meems bontepaarden at gmail.com
Fri Jun 29 01:50:44 PDT 2018


Thanks Even for the suggestion.

We already thought about polygonizing the raster. But then I would have
less control about where the vector geometry is created.
The squares/rectangle need to align with the tractor tracks/path.

The scenario I described is the first version: creating a fishnet. The next
version will be more complicated because it will really create the
square/rectangle along the tracks.
Making them less regular in the field.
I've attached an image I manually created with Inkscape for some
clarification.

[image: tracks.png]
Of course, the whole field will have the green rectangles.
I have not yet created the algorithm to create these non-fishnet
rectangles, but that is the end goal.
That's why I can't use polygonize (at least I think I can't) but need to
create the geometries first, then fill them with the pixel values and next
merge/dissolve the geometries with the same values.

Regards,

Paul

Op do 28 jun. 2018 om 13:25 schreef Even Rouault <even.rouault at spatialys.com
>:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180629/391f4e1a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tracks.png
Type: image/png
Size: 37221 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180629/391f4e1a/attachment-0001.png>


More information about the gdal-dev mailing list