Esempio n. 1
0
        private ConversionResult ExecuteStaticEpsg(TestCase testCase)
        {
            var result = new ConversionResult();
            try {

                var paths = _epsgPathGenerator.Generate(testCase.Source, testCase.Target)
                    .OrderBy(x => GetEpsgAccuracy(x) ?? 999);

                var compiler = new StaticCoordinateOperationCompiler();
                var compiledPaths = paths
                    .Select(x => compiler.Compile(x));

                var bestCompiledPath = compiledPaths.FirstOrDefault(x => x != null);

                var transformation = bestCompiledPath;
                if (transformation == null)
                    throw new InvalidOperationException("No compiled transformation");

                result.ResultData = transformation.TransformValues(testCase.InputCoordinates).ToArray();
            }
            catch (Exception ex) {
                result.Exception = ex;
            }

            return result;
        }
Esempio n. 2
0
        private ConversionResult ExecuteProj4(TestCase testCase)
        {
            var result = new ConversionResult();
            try {
                var transformation = new Proj4Transform(testCase.Source, testCase.Target);
                if(transformation == null)
                    throw new InvalidOperationException("No transformation");

                result.ResultData = transformation.TransformValues(testCase.InputCoordinates).ToArray();
            }
            catch (Exception ex) {
                result.Exception = ex;
            }
            return result;
        }