Creates coordinate transformations.
Inheritance: ICoordinateTransformationFactory
Ejemplo n.º 1
0
 private static ICoordinateTransformation Proj2Geog(IProjectedCoordinateSystem source, IGeographicCoordinateSystem target)
 {
     if (source.GeographicCoordinateSystem.EqualParams(target))
     {
         IMathTransform mathTransform = CreateCoordinateOperation(source.Projection, source.GeographicCoordinateSystem.HorizontalDatum.Ellipsoid, source.LinearUnit).Inverse();
         return new CoordinateTransformation(source, target, TransformType.Transformation, mathTransform,
             String.Empty, String.Empty, -1, String.Empty, String.Empty);
     }
     else
     {	// Geographic coordinatesystems differ - Create concatenated transform
         ConcatenatedTransform ct = new ConcatenatedTransform();
         CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();
         ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(source, source.GeographicCoordinateSystem));
         ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(source.GeographicCoordinateSystem, target));
         return new CoordinateTransformation(source,
             target, TransformType.Transformation, ct,
             String.Empty, String.Empty, -1, String.Empty, String.Empty);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates geographic to geographic transformation.
 /// </summary>
 /// <remarks>Adds a datum shift if nessesary</remarks>
 /// <param name="source">Source coordinate system</param>
 /// <param name="target">TargetCoordinate system</param>
 /// <returns>The requested transformation</returns>
 private ICoordinateTransformation CreateGeog2Geog(IGeographicCoordinateSystem source, IGeographicCoordinateSystem target)
 {
     if (source.HorizontalDatum.EqualParams(target.HorizontalDatum))
     {
         //datum shift is not needed
         return new CoordinateTransformation(source,
             target, TransformType.Conversion, new GeographicTransform(source, target),
             String.Empty, String.Empty, -1, String.Empty, String.Empty);
     }
     else
     {
         //datum shift
         // transformation into a geocentric system, datum shift and return to the system of geographical
         CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();
         CoordinateSystemFactory cFac = new CoordinateSystemFactory();
         IGeocentricCoordinateSystem sourceCentric = cFac.CreateGeocentricCoordinateSystem(source.HorizontalDatum.Name + " Geocentric",
             source.HorizontalDatum, LinearUnit.Metre, source.PrimeMeridian);
         IGeocentricCoordinateSystem targetCentric = cFac.CreateGeocentricCoordinateSystem(target.HorizontalDatum.Name + " Geocentric",
             target.HorizontalDatum, LinearUnit.Metre, source.PrimeMeridian);
         ConcatenatedTransform ct = new ConcatenatedTransform();
         ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(source, sourceCentric));
         ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(sourceCentric, targetCentric));
         ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(targetCentric, target));
         return new CoordinateTransformation(source,
             target, TransformType.Transformation, ct,
             String.Empty, String.Empty, -1, String.Empty, String.Empty);
     }
 }
Ejemplo n.º 3
0
        private static ICoordinateTransformation Proj2Proj(IProjectedCoordinateSystem source, IProjectedCoordinateSystem target)
        {
            ConcatenatedTransform ct = new ConcatenatedTransform();
            CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();
            //First transform from projection to geographic
            ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(source, source.GeographicCoordinateSystem));
            //Transform geographic to geographic:
            ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(source.GeographicCoordinateSystem, target.GeographicCoordinateSystem));
            //Transform to new projection
            ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(target.GeographicCoordinateSystem, target));

            return new CoordinateTransformation(source,
                target, TransformType.Transformation, ct,
                String.Empty, String.Empty, -1, String.Empty, String.Empty);
        }