/// <summary> /// Method to ensure the static constructor is being called. /// </summary> /// <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks> public static void ConfigureOgr() { if (_configuredOgr) return; // Register drivers Ogr.RegisterAll(); _configuredOgr = true; PrintDriversOgr(); }
private static void PrintDriversOgr() { #if DEBUG var num = Ogr.GetDriverCount(); for (var i = 0; i < num; i++) { var driver = Ogr.GetDriver(i); Console.WriteLine(string.Format("OGR {0}: {1}", i, driver.name)); } #endif }
/// <summary> /// Method to ensure the static constructor is being called. /// </summary> /// <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks> public static void ConfigureOgr() { if (_configuredOgr) { return; } // Register drivers Ogr.RegisterAll(); _configuredOgr = true; }
private static void PrintDriversOgr() { if (DebugUtil._debug) { var num = Ogr.GetDriverCount(); for (var i = 0; i < num; i++) { var driver = Ogr.GetDriver(i); DebugUtil.WriteLine(string.Format("OGR {0}: {1}", i, driver.name)); } } }
///// <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(); } }
private static void PrintDriversOgr() { #if DEBUG if (_usable) { var num = Ogr.GetDriverCount(); for (var i = 0; i < num; i++) { var driver = Ogr.GetDriver(i); Trace.WriteLine($"OGR {i}: {driver.GetName()}", "Debug"); } } #endif }
/// <summary> /// Method to ensure the static constructor is being called. /// </summary> /// <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks> public static void ConfigureOgr() { if (_configuredOgr) { return; } // Register drivers Ogr.GetDriverByName("S57"); //Ogr.RegisterAll(); _configuredOgr = true; PrintDriversOgr(); }
///// <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; ConnectionID = filename; _ogrDataSource = OgrOgr.OpenShared(filename, 0); using (var ogrLayer = GetLayer(layerNum)) { OsrSpatialReference spatialReference = ogrLayer.GetSpatialRef(); if (spatialReference != null) { SRID = spatialReference.AutoIdentifyEPSG(); } } _layerIndex = layerNum; }
/// <summary> /// Method to get a layer based on a private copy of the data source /// </summary> /// <param name="layerIndex">The layer index</param> /// <param name="ogrDataSource">The data source</param> /// <returns></returns> private OgrLayer GetLayer(int layerIndex, out OgrDataSource ogrDataSource) { ogrDataSource = OgrOgr.OpenShared(Filename, 0); return(ogrDataSource.GetLayerByIndex(layerIndex)); }
static Ogr() { FwToolsHelper.Configure(); OgrOgr.RegisterAll(); }