[gdal-dev] OGRGeometry::Intersection returns NULL

Alisson Barbosa alisson.uece at gmail.com
Wed Oct 10 10:48:07 PDT 2012


Hello, guys!

I'm truggling through a rough moment here...
I have this piece of code in a project that I work on:

if(basinPolygon->Intersects(luPolygon))
{
        OGRGeometry *result = basinPolygon->Intersection(luPolygon);
        if(result)
                newLayer.push_back(result);
}

Somehow, the Intersects function returns true for those polygons
(basinPolygon and luPolygon) (i.e. there is a intersection area between
them), but

    basinPolygon->Intersection(luPolygon);

Always returns NULL! why is it returning NULL if Intersects returns true?!
This is a mistery for me!
:(

If I replace Intersection by another similar method like Union, I still get
a NULL as response.

Here is the documentation of
OGRGeometry::Intersection<http://www.gdal.org/ogr/classOGRGeometry.html#a202ad4c29487ca046c4a2b055042cb6a>

It tells me that a NULL can be returned if an error occurs. But I don't
have any clue to actually know if some error (and which error) has occured!

Anyone? Any ideias? :S
Thanks in advance,
hbobenicio.

-- 
Alisson Barbosa
Systems Analyst - FUNCEME - Brazil
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/20121010/b91412ba/attachment.html>


More information about the gdal-dev mailing list