Hi Ricardo,<br><br>I had to do the same thing yesterday and wrote the script that's attached here. It will read a raster data file and create a polygon for each pixel that does not have a value of 0.0. The input, output and pixel value are all hard-coded, and the script is pretty crude, but it seems to work. I'll warn you ahead of time that the shapefiles it creates are large, with a very high feature count. Oh, and I make no attempt to assign SRS, the shapefile will be in whatever projection the input raster is in.
<br><br>Hope that helps,<br><br>Roger<br>--<br>PS - If anyone else reads this and has suggestions for optimizing performance, I would really welcome them.<br><br>----------------------------------------------<br><br><div class="gmail_quote">
On Jan 10, 2008 11:18 AM, Chris Barker <<a href="mailto:Chris.Barker@noaa.gov">Chris.Barker@noaa.gov</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Ricardo Scachetti Pereira wrote:<br>> What I really need is some API or software library (preferably in C<br>> or C++) that I could use to convert ESRI Arc/Info Grids (the binary<br>> kind) to a Shapefile of polygons.
<br><br></div>Well, no, that doesn't answer the question at all. Polygons and Raster<br>data are completely different concepts. Raster data is one or more<br>values at a bunch of points on a grid -- what do you want your polygons
<br>to represent? I can think of two fairly obvious possibilities:<br><br>1) There are polygons visually represented in the raster -- maybe is was<br>actually created by rendering polygons in the first place (like a map<br>
with boundaries or something). In this case, you're looking for line<br>tracing or edge-detection tools.<br><br>2) Your raster represent some continuous field, like elevation n a DEM .<br>In this case, you might want to contour the data, and get the contours
<br>as polygons. If this is the case, look for contouring code.<br><br>There are probably an infinite number of other ways one might want to<br>extract polygons from raster data -- we need to know what you're trying<br>
to do to help any more.<br><br>-Chris<br><br><br>--<br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax
<br>Seattle, WA 98115 (206) 526-6317 main reception<br><font color="#888888"><br><a href="mailto:Chris.Barker@noaa.gov">Chris.Barker@noaa.gov</a><br></font><div><div></div><div class="Wj3C7c">_______________________________________________
<br>gdal-dev mailing list<br><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev
</a><br></div></div></blockquote></div><br>