[fdo-users] SHP polygons & holes issue

Dan Stoica dan.stoica at autodesk.com
Mon Mar 26 12:45:47 EDT 2007

The problem is the tool that created the SHP...

Apparently there are lots of SHP files around in this state. To make things worse, there is no native multi-polygon type which could help FDO to distinguish between a polygon with holes and a set of not related polygons.

It has been decided that FDO should not attempt to correct the polygons (i.e. to change the rings order etc). One of the reasons was the performance (it is a quite expesive operation).

The actual type and the rings order only matters when it comes to spatial queries. There was a bug around it which has been recenly fixed (see ticket #43).

In case your application really needs a well formed polygon, note there is a function that reconstructs a geometry given a collection of rings:

newGeometry = FdoSpatialUtility::CreateGeometryFromRings (rings, true);

This method will return either a Polygon or a MultiPolygon.

Or have a look at ShpFeatIdQueryEvaluator::ReconstructPolygon( FdoIGeometry *geometry ) to how it has been done.


-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Ytse
Sent: Monday, March 26, 2007 12:23 PM
To: fdo-users at lists.osgeo.org
Subject: [fdo-users] SHP polygons & holes issue

You'll find a zip file attached to this mail containing one feature, a polygon with a hole in it.

When I read in .NET using this code (after a ISelect statement)

            FgfGeometryFactory gf = new FgfGeometryFactory();
            IGeometry geo = gf.CreateGeometryFromFgf( reader.GetGeometry("Geometry")  );

I'm getting something that confuses me : the exterioring has 8 points, and there's one interiorring of 320 points. Which corresponds to an inversion of the inner and exterior ring.

I'd be glad if anyone of this board could doublecheck this and tell me if that's something from the tool that created the shape, something from my code or if it's somehow a mystake in the SHP Provider (I could check the rings area to notice those cases but that would be something heavy for the rare times it will occur) as I don't have the slightiest idea of how it should be stored in the physical .shp file.

Thank you


Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses 

More information about the fdo-users mailing list