[gdal-dev] Polygonizer / Lines
alisson.uece at gmail.com
Fri Mar 15 05:50:31 PDT 2013
Thank you Chaitanya,
I had read the explanation of Peter Halls. But that was *raster
polygonization*. I am currently working with another type: *polygonization
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)
mls = pTemp;
2013/3/14 Chaitanya kumar CH <chaitanya.ch at gmail.com>
> You can refer to the method's documentation here:
> The mechanism of this operation was already explained Peter Halls in this
> mailing list. 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.
> : 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>
>>> 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
>> Alisson Barbosa
>> Systems Analyst - FUNCEME
>> M.Sc. in Computer Science - MACC
>> Graduate in Computer Science - UECE
> Best regards,
> Chaitanya kumar CH.
> 17.2416N 80.1426E
Systems Analyst - FUNCEME
M.Sc. in Computer Science - MACC
Graduate in Computer Science - UECE
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev