This project is read-only.

2D Geometry from 3D Geometry

May 12, 2011 at 10:38 PM

Anybody know the best way of computing a 2D Geometry from a 3D Geometry?  I get a feature from a 3D featureset by doing a spatial query with a 2D geometry.  Then, I want to do some further intersection calculations using the Topology code.  But, it does not like me having a mixture of true 3D IGeometries and some IGeometries with 0 for z.  I'm going to try this, but it seems really a dumb way to do it:

foreach (IFeature feature in ifsSelected.Features)
    IGeometry fg = Geometry.FromBasicGeometry(feature.BasicGeometry);
    foreach (Coordinate c in fg.Coordinates)
         c.Z = double.NaN;


What I'd really like is a way to create a new 2D geometry from the original 3D geometry, and I bet there's a method for that somewhere in the bowels of DotSpatial