public void ListAllLayers()
        {
            var ds = new OgrDatasource();

            try
            {
                if (!ds.Open(CONNECTION_STRING))
                {
                    Assert.Fail("Failed to establish connection: " + ds.GdalLastErrorMsg);
                }
                Debug.WriteLine("ds.LayerCount: " + ds.LayerCount);
                for (var i = 0; i < ds.LayerCount; i++)
                {
                    var layer = ds.GetLayer2(i, false, false);
                    Debug.WriteLine(layer.Name + " has " + layer.FeatureCount + " features. Projection is " + layer.GeoProjection.Name);
                }
            }
            finally
            {
                ds.Close();
            }
        }
Esempio n. 2
0
        public VectorLayer GetLayer2(int index, bool forUpdate = false, bool newConnection = true)
        {
            var layer = _datasource.GetLayer2(index, forUpdate, newConnection);

            return(layer != null ? new VectorLayer(layer) : null);
        }