[gdal-dev] Polygonizer / Lines

Alisson Barbosa alisson.uece at gmail.com
Mon Mar 18 06:25:41 PDT 2013


Yes Peter. I'm trying to get the Thiessen polygons.

Thanks for the tips, but the Polygonize method of OGRMultiLineString worked
for me.

Thank you.

2013/3/15 Peter Halls <p.halls at york.ac.uk>

> Alisson,
>
>      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.
>
> Does that help?
>
> Best wishes,
>
> Peter
>
>
> On 15 March 2013 12:50, Alisson Barbosa <alisson.uece at gmail.com> wrote:
>
>> Thank you Chaitanya,
>>
>> I had read the explanation of Peter Halls. But that was *raster
>> polygonization*. I am currently working with another type: *
>> polygonization of OGRLineStrings*.
>>
>> 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.
>>
>> I solved using this:
>>
>> OGRMultiLineString *mls = new OGRMultiLineString();
>> OGRMultiLineString* pTemp = NULL;
>> while(...) //iteration of lines
>> {
>>         //creation of line
>>         pTemp = static_cast<OGRMultiLineString*>(mls->Union(line));
>>         if (pTemp != NULL)
>>         {
>>             if( mls != NULL)
>>             {
>>                 if( mls->getNumGeometries() > 0)
>>                     delete mls;
>>             }
>>             mls = pTemp;
>>         }
>> }
>>
>> Thanks,
>>
>> 2013/3/14 Chaitanya kumar CH <chaitanya.ch at gmail.com>
>>
>>> Alisson,
>>>
>>> You can refer to the method's documentation here:
>>> http://www.gdal.org/ogr/classOGRGeometry.html#a674319670e735bf6d4049300096157ec
>>>
>>> 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.
>>>
>>> However, it's your job to ensure that all the line strings passed to the
>>> method are part of a single polygon.
>>>
>>> [1]: http://lists.osgeo.org/pipermail/gdal-dev/2012-November/034793.html
>>>
>>>
>>> On Thu, Mar 14, 2013 at 11:58 PM, Alisson Barbosa <
>>> alisson.uece at gmail.com> wrote:
>>>
>>>> Can you explain a bit better?
>>>>
>>>>
>>>> 2013/3/14 Chaitanya kumar CH <chaitanya.ch at gmail.com>
>>>>
>>>>> Allison,
>>>>>
>>>>> Check out OGRGeometry::Polygonize()
>>>>>
>>>>> The result depends on the type of intersections in your lines.
>>>>>
>>>>> --
>>>>> Best regards,
>>>>> Chaitanya Kumar CH
>>>>> On 14 Mar 2013 21:53, "Alisson Barbosa" <alisson.uece at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi friends,
>>>>>>
>>>>>> 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?
>>>>>>
>>>>>> Best regards,
>>>>>> --
>>>>>> Alisson Barbosa
>>>>>> Systems Analyst - FUNCEME
>>>>>> M.Sc. in Computer Science - MACC
>>>>>> Graduate in Computer Science  - UECE
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> gdal-dev mailing list
>>>>>> gdal-dev at lists.osgeo.org
>>>>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Alisson Barbosa
>>>> Systems Analyst - FUNCEME
>>>> M.Sc. in Computer Science - MACC
>>>> Graduate in Computer Science  - UECE
>>>>
>>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Chaitanya kumar CH.
>>>
>>> +91-9494447584
>>> 17.2416N 80.1426E
>>>
>>
>>
>>
>> --
>> Alisson Barbosa
>> Systems Analyst - FUNCEME
>> M.Sc. in Computer Science - MACC
>> Graduate in Computer Science  - UECE
>>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>
>
> --
>
> ----------------------------------------------------------------------------------------------------------------
> Peter J Halls, GIS Advisor & Team Leader Applications Support and
> Training,
>                Information Directorate, University of York
> Telephone: 01904 323806     Fax: 01904 323740
> Snail mail: Harry Fairhurst Building, University of York,
>                 Heslington, York YO10 5DD
> This message has the status of a private and personal communication
>
> ----------------------------------------------------------------------------------------------------------------
>



-- 
Alisson Barbosa
Systems Analyst - FUNCEME
M.Sc. in Computer Science - MACC
Graduate in Computer Science  - UECE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130318/f1f844ec/attachment.html>


More information about the gdal-dev mailing list