<div dir="ltr"><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Thanks Even for the suggestion.</div><div dir="ltr"><br></div><div dir="ltr">We already thought about polygonizing the raster. But then I would have less control about where the vector geometry is created.</div><div dir="ltr">The squares/rectangle need to align with the tractor tracks/path.</div><div dir="ltr"><br></div><div dir="ltr">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.</div><div>Making them less regular in the field. </div><div>I've attached an image I manually created with Inkscape for some clarification.</div><div><br></div><div><div><div><img src="cid:ii_jizqf5m01" alt="tracks.png" width="562" height="444"><br></div>Of course, the whole field will have the green rectangles.</div></div><div>I have not yet created the algorithm to create these non-fishnet rectangles, but that is the end goal.</div><div>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.</div><div><br></div><div dir="ltr">Regards,<br>
<br>Paul<br></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Op do 28 jun. 2018 om 13:25 schreef Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On jeudi 28 juin 2018 12:53:27 CEST Paul Meems wrote:<br>
> Hi list,<br>
> <br>
> I've been working on this for months (off and on) and still no satisfying<br>
> outcome.<br>
> Either the process takes too long (multiple hours) or the result has<br>
> invalid geometries.<br>
> <br>
> I want to try a different angle now. Instead of asking technical questions<br>
> I want to explain what I try to do. Hopefully, somebody has a<br>
> suggestion/hint which gives me some new insights.<br>
> <br>
> I have a high-resolution geotiff (drone image). And I need to create a<br>
> taskmap in shapefile format.<br>
> This taskmap is used in the tractor (precision farming) for variable<br>
> spraying crop protection agents or variable fertilization using GPS, etc.<br>
> <br>
> The user starts by giving the precision (width and height) of the taskmap.<br>
> I then create a fishnet over the tiff using the given width and height.<br>
> Typical values can 1 by 1 meter or less. This results in a dataset with a<br>
> lot of square/rectangles (1.5 - 2 million). Next step is to rotate the<br>
> fishnet to align with the tractor path and clip with the field border. Then<br>
> for each geometry, I get the pixel values from the tiff inside the<br>
> geometry. I calculate the average and add this value as 'Rating' to the<br>
> geometry.<br>
> This process is fast enough, about 20-30 seconds.<br>
> <br>
> Next step is the slow part.<br>
> I need to merge the adjacent geometries with the same rating. Multipolygons<br>
> are not needed. If created I will break them apart later.<br>
> <br>
> Of course, I tried using GDAL+GEOS and the result seems OK, but it takes<br>
> hours to finish.<br>
> <br>
> Reading my long description, how would you handle this challenge?<br>
> I'm open to any suggestion.<br>
<br>
What about rotating your raster so that the fishnet is horizontal/vertical <br>
lines in that rotated raster ? Then you could clip, resample it to desired <br>
resolution. And you would use gdal_polygonize, which would merge the cells of <br>
same value quickly<br>
<br>
<br>
-- <br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</blockquote></div></div>