コード例 #1
0
        /// <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();
        }
コード例 #2
0
        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
        }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
ファイル: GdalConfiguration.cs プロジェクト: htcvszrf/S57Map
 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));
         }
     }
 }
コード例 #5
0
        ///// <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();
            }
        }
コード例 #6
0
ファイル: OgrProvider.cs プロジェクト: cugkgq/Project
        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();
            }
        }
コード例 #7
0
        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
        }
コード例 #8
0
ファイル: GdalConfiguration.cs プロジェクト: htcvszrf/S57Map
        /// <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();
        }
コード例 #9
0
ファイル: OgrProvider.cs プロジェクト: klosejay/Gisoft.Map
        ///// <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;
        }
コード例 #10
0
ファイル: OgrProvider.cs プロジェクト: klosejay/Gisoft.Map
 /// <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));
 }
コード例 #11
0
ファイル: OgrProvider.cs プロジェクト: cugkgq/Project
 static Ogr()
 {
     FwToolsHelper.Configure();
     OgrOgr.RegisterAll();
 }