Thanks a lot, Roger, it worked like a charm, just fiddling a little with parameters and than run it in python. <br><div class="gmail_quote">It's really magic, I struggled with this question for two days before writing to the list.<br>

I think that instead of making another script you could add it as an option to gdal_contour.py and use it alternatively with -l (default) or -p (output to polygons).<br>By the way, another enhancement for gdal_contour could be adding an options to cut the output with a line or polygon layer (say the shoreline or other boundary).<br>

c<br><br><div class="HOEnZb"><div class="h5"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><font color="#888888">
c<br><br></font></span><div class="gmail_quote"><div>On Wed, Jul 3, 2013 at 8:04 PM, Roger Veciana i Rovira <span dir="ltr"><<a href="mailto:rveciana@gmail.com" target="_blank">rveciana@gmail.com</a>></span> wrote:<br>


</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div dir="ltr">Hi, I was just working on that.<div>I think that you need a script like gdal_contour, but creatig polygons instead of lines. The algorithm used is Marching Squares.<br><div>You can see the code, without explanation, here:</div>




<div><a href="https://github.com/rveciana/geoexamples/tree/master/python/raster_isobands" target="_blank">https://github.com/rveciana/geoexamples/tree/master/python/raster_isobands</a><br></div></div><div>In some weeks I'll add some more info in a README file and transform the file into a working script, not just a function. But you can use it just changing the file name and the intervals.</div>




<div><br></div><div>Roger</div></div></div></blockquote></div></blockquote></div></div></div></div>