Beispiel #1
0
        /// <summary>
        /// Setup the underlying CoreXDotNet singleton management classes.
        /// </summary>
        private void SetupTGL()
        {
            var xmlFilePath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "CoordSystemDatabase.xml");

            if (!File.Exists(xmlFilePath))
            {
                throw new Exception($"Failed to find TGL CSD database file '{xmlFilePath}'.");
            }

            using var reader = new StreamReader(xmlFilePath);
            var xmlData = reader.ReadToEnd();

            CsdManagement.csmLoadCoordinateSystemDatabase(xmlData)
            .Validate($"attempting to load coordinate system database '{xmlFilePath}'");

            _log.LogInformation($"CoreX {nameof(SetupTGL)}: GeodeticDatabasePath='{GeodeticDatabasePath}'");

            if (string.IsNullOrEmpty(GeodeticDatabasePath))
            {
                throw new Exception("Environment variable TGL_GEODATA_PATH must be set to the Geodetic data folder.");
            }
            if (!Directory.Exists(GeodeticDatabasePath))
            {
                _log.LogInformation($"Failed to find directory '{GeodeticDatabasePath}' defined by environment variable TGL_GEODATA_PATH.");
            }
            else
            {
                CoreXGeodataLogger.DumpGeodataFiles(_log, GeodeticDatabasePath);
            }

            CsdManagement.csmSetGeodataPath(GeodeticDatabasePath);
            GeodeticX.geoSetGeodataPath(GeodeticDatabasePath);
        }
Beispiel #2
0
        private IGeodeticXTransformer GeodeticXTransformer(string csib)
        {
            using var geoCsibBlobContainer = CreateGeoCsibBlobContainer(csib);
            using var transformer          = new PointerPointer_IGeodeticXTransformer();

            GeodeticX.geoCreateTransformer(geoCsibBlobContainer, transformer)
            .Validate("attempting to create GeodeticX transformer");

            return(transformer.get());
        }