Hi!

I have this very simple problem which I don't understand. I am loading a shape 
file (multipolygon) and copying the geometry into a new structure:

            OSGeo.OGR.Geometry geometries = new 
OSGeo.OGR.Geometry(OSGeo.OGR.wkbGeometryType.wkbMultiPolygon);

            OSGeo.OGR.DataSource dataSource = OSGeo.OGR.Ogr.Open(filename, 0);
            OSGeo.OGR.Layer layer = dataSource.GetLayerByIndex(0);
            OSGeo.OGR.Feature currentFeature = null;
            layer.ResetReading();
            while ((currentFeature = layer.GetNextFeature()) != null)
            {
                string wkt = string.Empty;
                currentFeature.GetGeometryRef().ExportToWkt(out wkt); --> 
MULTIPOLYGON (((476587.2 6100012.8, .... ,533324.8 6190163.2)))
                geometries.AddGeometry(currentFeature.GetGeometryRef());
                string wkt2 = string.Empty;
                geometries.ExportToWkt(out wkt2); --> MULTIPOLYGON EMPTY
            }
            dataSource.Dispose();

Am I doing something completely wrong here?

I just want all of the geometry in the input file put into the variable 
geometries for later use.

The input data is a rather large data set and before I try to strip it down, I 
just want to know if my approach is wrong or if I can expect this to be working.

GDAL/OGR version: 1.9.2, C# bindings from Tamas daily builds.

Regards Casper





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

Reply via email to