///// <summary> ///// Loads a Ogr datasource with the specified layer ///// </summary> ///// <param name="filename">datasource</param> ///// <param name="layerName">name of layer</param> /////If you want this functionality use /////<example> /////SharpMap.Data.Providers.Ogr prov = new SharpMap.Data.Providers.Ogr(datasource); /////prov.LayerName = layerName; /////</example> //[Obsolete("This constructor does not work well with VB.NET. Use LayerName property instead")] //public Ogr(string filename, string layerName) //{ // Filename = filename; // _ogrDataSource = OgrOgr.Open(filename, 1); // _ogrLayer = _ogrDataSource.GetLayerByName(layerName); // OsrSpatialReference spatialReference = _ogrLayer.GetSpatialRef(); // if (spatialReference != null) // SRID = spatialReference.AutoIdentifyEPSG(); //} /// <summary> /// Loads a Ogr datasource with the specified layer /// </summary> /// <param name="filename">datasource</param> /// <param name="layerNum">number of layer</param> public Ogr(string filename, int layerNum) { Filename = filename; _ogrDataSource = OgrOgr.Open(filename, 0); _ogrLayer = _ogrDataSource.GetLayerByIndex(layerNum); OsrSpatialReference spatialReference = _ogrLayer.GetSpatialRef(); if (spatialReference != null) { SRID = spatialReference.AutoIdentifyEPSG(); } }
public Ogr(string filename, string layerName) { Filename = filename; _ogrDataSource = OgrOgr.Open(filename, 1); _ogrLayer = _ogrDataSource.GetLayerByName(layerName); OsrSpatialReference spatialReference = _ogrLayer.GetSpatialRef(); if (spatialReference != null) { _srid = spatialReference.AutoIdentifyEPSG(); } }