[gdal-dev] Polygonizer / Lines
Alisson Barbosa
alisson.uece at gmail.com
Fri Mar 15 06:19:27 PDT 2013
Attached...
2013/3/15 Chaitanya kumar CH <chaitanya.ch at gmail.com>
> Alisson,
>
> Can you provide a sample dataset that didn't work?
>
>
> On Fri, Mar 15, 2013 at 6:20 PM, 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
>>
>>
>
>
> --
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130315/b3a12058/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.zip
Type: application/zip
Size: 1562 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130315/b3a12058/attachment.zip>
More information about the gdal-dev
mailing list