[gdal-dev] Geometry.Intersects and .Intersection

Henneke, Amanda M amanda.m.henneke at boeing.com
Fri Apr 17 13:40:15 EDT 2009


I think I figured out why this wasn't working, I guess LinearRings
aren't considered full-fledged geometry objects, so it only works if you
add it to a polygon, then test for intersections.

Thanks anyway... 

Amanda 

-----Original Message-----
From: Henneke, Amanda M 
Sent: Thursday, April 16, 2009 10:07 AM
To: gdal-dev at lists.osgeo.org
Subject: [gdal-dev] Geometry.Intersects and .Intersection

Hello everyone-

Has anyone played with Geometry.Intersects or Geometry.Intersection?  

I have an instance where the Geometry.Intersects method returns true on
two LinearRings, but then when I do the Intersection, it's returning
nothing (null).  I'm not sure why this would be.  I found a few things
on the web about the versions of FWTools.  I am using 1.3.5 with the C#
API for GDAL/OGR.

Any help/advice would be appreciated.  I've included a code snippet:

                     bool bIntersects = geoRing.Intersect(geoOldRing);

                     if (iPt > 0 && bIntersects)
                     {
                        Geometry geoRingDiff =
geoRing.Intersection(geoOldRing);
                        if (geoRingDiff != null)
                        {
                           wkbGeometryType gType =
geoRingDiff.GetGeometryType();
                           string text = "";
                           geoRingDiff.ExportToWkt(out text);
                           Console.WriteLine(text);
                           geoRingDiff.CloseRings();
                           geoRingNew = geoRing.Difference(geoRingDiff);
                           geoOldRing = geoRingNew.Clone();

                           // Add the ring to the polygon layer
                           geoPolygon.AddGeometry(geoRingNew);
                        }
                     }
   

Thanks,
Amanda

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list