Alisson,<br><br>     in vector mode, where you are working with linestrings, the procedure is as described in Stephen Wise's book, GIS Basics (Taylor & Francis, 2002) chapters 2 - 4.  You will need to compute the intersection of all the lines (Chapter 3), split them at the intersections and either duplicate the common boundary segments or (my preferred way) build a simple topology table that lists each line segment required for each polygon.  That way you can still output the set of complete polygons to a shapefile (no topology).  You will need to take account of the fact that some line segments must be reversed when building the polygon.<br>
<br>Does that help?<br><br>Best wishes,<br><br>Peter<br><br><div class="gmail_quote">On 15 March 2013 12:50, Alisson Barbosa <span dir="ltr"><<a href="mailto:alisson.uece@gmail.com" target="_blank">alisson.uece@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you Chaitanya,<br><br>I had read the explanation of Peter Halls. But that was <i><b>raster polygonization</b></i>. <span lang="en"><span>I am currently</span> <span>working</span> <span>with another type</span><span>:</span> <b><i><span>polygonization</span> <span>of</span> <span>OGRLineStrings</span></i></b><span>.</span></span> <br>

<br>My question was because i was not able to polygonize using the mentioned method. I created an OGRMultiLineString or an OGRGeometryCollection and added geometries (many OGRLineStrings) by addGeometry or addGeometryDirectly methods. But the polygonization always returned null.<br>

<br>I solved using this:<br><br>OGRMultiLineString *mls = new OGRMultiLineString();        <br>OGRMultiLineString* pTemp = NULL;<br>while(...) //iteration of lines<br>{       <br>        //creation of line<br>        pTemp = static_cast<OGRMultiLineString*>(mls->Union(line));<br>

        if (pTemp != NULL) <br>        {<br>            if( mls != NULL)<br>            {<br>                if( mls->getNumGeometries() > 0)<br>                    delete mls;<br>            }<br>            mls = pTemp;<br>

        }<br>}        <br><br>Thanks,<br><br><div class="gmail_quote">2013/3/14 Chaitanya kumar CH <span dir="ltr"><<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div><div>Alisson,<br><br>You can refer to the method's documentation here: <a href="http://www.gdal.org/ogr/classOGRGeometry.html#a674319670e735bf6d4049300096157ec" target="_blank">http://www.gdal.org/ogr/classOGRGeometry.html#a674319670e735bf6d4049300096157ec</a><br>


<br></div>The mechanism of this operation was already explained Peter Halls in this mailing list[1]. GEOS does a good job identifying line strings touching at end points and then combining them to make rings and then polygons.<br>


<br></div>However, it's your job to ensure that all the line strings passed to the method are part of a single polygon.<br><div><br>[1]: <a href="http://lists.osgeo.org/pipermail/gdal-dev/2012-November/034793.html" target="_blank">http://lists.osgeo.org/pipermail/gdal-dev/2012-November/034793.html</a><br>


</div></div><div class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Thu, Mar 14, 2013 at 11:58 PM, Alisson Barbosa <span dir="ltr"><<a href="mailto:alisson.uece@gmail.com" target="_blank">alisson.uece@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can you explain a bit better?<div><div><br><br><div class="gmail_quote">2013/3/14 Chaitanya kumar CH <span dir="ltr"><<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>></span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Allison,</p>
<p dir="ltr">Check out OGRGeometry::Polygonize()</p>
<p dir="ltr">The result depends on the type of intersections in your lines.</p>
<p dir="ltr">--<br>
Best regards,<br>
Chaitanya Kumar CH</p>
<div class="gmail_quote"><div><div>On 14 Mar 2013 21:53, "Alisson Barbosa" <<a href="mailto:alisson.uece@gmail.com" target="_blank">alisson.uece@gmail.com</a>> wrote:<br type="attribution"></div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
Hi friends,<br><br>I have a set of OGRLineStrings and an OGRLinearRing with many intersections. I would like to polygonize this set of lines. Can anybody help me?<br><br>Best regards,<br>-- <br>Alisson Barbosa<div>Systems Analyst - FUNCEME<div>





<span lang="en"><span title="Clique para mostrar traduções alternativas">M.Sc. in Computer Science</span><span title="Clique para mostrar traduções alternativas"> - MACC</span></span><div><div>Graduate in Computer Science  - UECE</div>





</div></div><br></div>
<br></div></div>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">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></blockquote></div>
</blockquote></div><br><br clear="all"><br>-- <br>Alisson Barbosa<div>Systems Analyst - FUNCEME<div><span lang="en"><span title="Clique para mostrar traduções alternativas">M.Sc. in Computer Science</span><span title="Clique para mostrar traduções alternativas"> - MACC</span></span><div>



<div>Graduate in Computer Science  - UECE</div></div></div><br></div>
</div></div></blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><br></font></span></div></div><span class="HOEnZb"><font color="#888888"><span><font color="#888888">-- <br>Best regards,<br>Chaitanya kumar CH.<br>
<br><a href="tel:%2B91-9494447584" value="+919494447584" target="_blank">+91-9494447584</a><br>
17.2416N 80.1426E
</font></span></font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br>Alisson Barbosa<div>Systems Analyst - FUNCEME<div><span lang="en"><span title="Clique para mostrar traduções alternativas">M.Sc. in Computer Science</span><span title="Clique para mostrar traduções alternativas"> - MACC</span></span><div>

<div>Graduate in Computer Science  - UECE</div></div></div><br></div>
</font></span><br>_______________________________________________<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></blockquote></div><br><br clear="all"><br>-- <br>----------------------------------------------------------------------------------------------------------------<br>
Peter J Halls, GIS Advisor & Team Leader Applications Support and Training, <br>               Information Directorate, University of York<br>Telephone: 01904 323806     Fax: 01904 323740<br>Snail mail: Harry Fairhurst Building, University of York, <br>
                Heslington, York YO10 5DD<br>This message has the status of a private and personal communication<br>----------------------------------------------------------------------------------------------------------------<br>