public static List <Geometry> Project(this List <Geometry> values, CoordinateReferenceSystemBase sourceSrs, CoordinateReferenceSystemBase targetSrs) { List <Geometry> result = new List <Geometry>(values.Count); if (sourceSrs.Ellipsoid.AreTheSame(targetSrs.Ellipsoid)) { for (int i = 0; i < values.Count; i++) { var c1 = values[i].Transform(p => sourceSrs.ToGeodetic(p), SridHelper.GeodeticWGS84); result.Add(c1.Transform(p => targetSrs.FromGeodetic(p), targetSrs.Srid)); } } else { for (int i = 0; i < values.Count; i++) { var c1 = values[i].Transform(p => sourceSrs.ToGeodetic(p), SridHelper.GeodeticWGS84); result.Add(c1.Transform(p => targetSrs.FromGeodetic(p, sourceSrs.Ellipsoid), targetSrs.Srid)); } } return(result); }
public static List <IShape> Project(List <IShape> values, CoordinateReferenceSystemBase sourceSrs, CoordinateReferenceSystemBase targetSrs) { List <IShape> result = new List <IShape>(values.Count); if (sourceSrs.Ellipsoid.AreTheSame(targetSrs.Ellipsoid)) { for (int i = 0; i < values.Count; i++) { var c1 = values[i].Transform(p => sourceSrs.ToGeodetic(p)); result.Add(c1.Transform(p => targetSrs.FromGeodetic(p))); } } else { for (int i = 0; i < values.Count; i++) { var c1 = values[i].Transform(p => sourceSrs.ToGeodetic(p)); result.Add(c1.Transform(p => targetSrs.FromGeodetic(p, sourceSrs.Ellipsoid))); } } return(result); }
public static IPoint Project(this IPoint point, CoordinateReferenceSystemBase sourceSrs, CoordinateReferenceSystemBase targetSrs) { if (sourceSrs.Ellipsoid.AreTheSame(targetSrs.Ellipsoid)) { var c1 = sourceSrs.ToGeodetic(point); return(targetSrs.FromGeodetic(c1)); } else { var c1 = sourceSrs.ToGeodetic(point); return(targetSrs.FromGeodetic(c1, sourceSrs.Ellipsoid)); } }