[gdal-dev] OGRGeometry::Intersection returns NULL

Alisson Barbosa alisson.uece at gmail.com
Tue Oct 16 06:11:51 PDT 2012


Solved! The problem was because my GDAL/OGR had not been compiled with GEOS.

2012/10/10 Even Rouault <even.rouault at mines-paris.org>

> Le mercredi 10 octobre 2012 19:48:07, Alisson Barbosa a écrit :
> > 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!
>
> The likely cause is documented in the page you quoted
>
> About Intersection(): "This method is built on the GEOS library, check it
> for
> the definition of the geometry operation. If OGR is built without the GEOS
> library, this method will always fail, issuing a CPLE_NotSupported error."
>
> About Intersects(): "If GEOS is enabled, then this is done in rigerous
> fashion
> otherwise TRUE is returned if the envelopes (bounding boxes) of the two
> features overlap."
>
> Take your symptoms and the above highlighted precisions, and you should
> have
> the answer.
>
>


-- 
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/20121016/52228f6e/attachment.html>


More information about the gdal-dev mailing list