I want a command line tool to do the same thing that "Feature to Polygon" of ArcGIS or Polygonizer plugin of Quantum GIS does. Is there any tool for this?<br><br><div class="gmail_quote">2012/11/26 Peter Halls <span dir="ltr"><<a href="mailto:p.halls@york.ac.uk" target="_blank">p.halls@york.ac.uk</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Alisson, Hugo,<br>
<br>
     I think a reason for the lack of response is that the operation<br>
you need is a tad more involved than is supported by ogr2ogr - which<br>
performs simple geometrical operations but is really designed to<br>
perform format translations.<br>
<br>
    To go from a spaghetti of lines to polygons requires the<br>
identification of each future polygon boundary, the assembly of the<br>
polygon boundary, ensuring that it closes and writing out the new<br>
polygon.  This much ogr2ogr does.  To go to multipolygons, however,<br>
requires the further assembly of the related polygons into a combined<br>
polygon - for example, islands in a lake.  All of this relies on the<br>
existence of attribute values to identify what belongs to what.<br>
Further complication is involved if the resultant polygons overlap and<br>
it is required that these overlaps be identified, although this is not<br>
required for a polygon shapefile.<br>
<br>
    As this process may require intelligence based upon more complex<br>
attribute relationships, it is probably the case that a program<br>
(Python, Java, C++, etc) is required to implement the specific logic<br>
required.<br>
<br>
    If you want to read up on the operations involved, one of the most<br>
approachable texts is 'GIS Basics' by Steve Wise (Taylor & Francis,<br>
2002).  The good news is that there are calls in the OGR API to<br>
implement each of the steps involved.<br>
<br>
Best wishes,<br>
<br>
Peter<br>
<div class="HOEnZb"><div class="h5"><br>
On 26 November 2012 12:24, Hugo Benicio <<a href="mailto:hbobenicio@gmail.com">hbobenicio@gmail.com</a>> wrote:<br>
> I'm facing a similar problem when trying to convert a shapefile containing<br>
> lines to a shapefile containing polygons.<br>
> No progress.<br>
> If you solve it, please, let me know!<br>
><br>
> Thanks in advance.<br>
><br>
><br>
> On Mon, Nov 26, 2012 at 8:47 AM, Alisson Barbosa <<a href="mailto:alisson.uece@gmail.com">alisson.uece@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Can anybody help me?<br>
>><br>
>><br>
>> 2012/11/23 Alisson Barbosa <<a href="mailto:alisson.uece@gmail.com">alisson.uece@gmail.com</a>><br>
>>><br>
>>> Hi friends,<br>
>>><br>
>>> I would like to transform a shape with multilinestring in a shape with<br>
>>> polygons using ogr2ogr.<br>
>>><br>
>>> Polygon to multilinestring, I use:<br>
>>> ogr2ogr -f "ESRI Shapefile" -overwrite "C:/Users/Alisson/Basins3.shp"<br>
>>> "C:/Users/Alisson/Basins2.shp" -sql "SELECT * FROM Basins2" -skipfailures<br>
>>> -nlt MULTILINESTRING<br>
>>><br>
>>> This works.<br>
>>><br>
>>> Multilinestring to multipolygon, I use:<br>
>>> ogr2ogr -f "ESRI Shapefile" -overwrite "C:/Users/Alisson/polygon.shp"<br>
>>> "C:/Users/AlissonContorno30.shp" -sql "SELECT * FROM Contorno30"<br>
>>> -skipfailures -nlt MULTIPOLYGON<br>
>>><br>
>>> But, this error appears:<br>
>>> ERROR 1: Attempt to write non-polygon (LINESTRING) geometry to POLYGON<br>
>>> type shapefile.<br>
>>><br>
>>> Can you help me?<br>
>>><br>
>>> Best regards,<br>
>>> --<br>
>>> Alisson Barbosa<br>
>>> Systems Analyst - FUNCEME<br>
>>> M.Sc. in Computer Science - MACC<br>
>>> Graduate in Computer Science  - UECE<br>
>>><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Alisson Barbosa<br>
>> Systems Analyst - FUNCEME<br>
>> M.Sc. in Computer Science - MACC<br>
>> Graduate in Computer Science  - UECE<br>
>><br>
>><br>
>><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>
><br>
><br>
><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>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<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>
</font></span></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><br>