public static List <Geometry <T> > Project <T>(this List <Geometry <T> > values, SrsBase sourceSrs, SrsBase targetSrs) where T : IPoint, new() { List <Geometry <T> > result = new List <Geometry <T> >(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 T Project <T>(this T point, SrsBase sourceSrs, SrsBase targetSrs) where T : IPoint, new() { 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)); } }
public static List <IEsriShape> Project(List <IEsriShape> values, SrsBase sourceSrs, SrsBase targetSrs) /*where TEsriPoint : IPoint, new()*/ { List <IEsriShape> result = new List <IEsriShape>(values.Count); if (sourceSrs.Ellipsoid.AreTheSame(targetSrs.Ellipsoid)) { for (int i = 0; i < values.Count; i++) { var c1 = values[i].Transform(p => sourceSrs.ToGeodetic <EsriPoint>(new EsriPoint() { X = p.X, Y = p.Y }), targetSrs.Srid); result.Add(c1.Transform(p => targetSrs.FromGeodetic <EsriPoint>(new EsriPoint() { X = p.X, Y = p.Y }), targetSrs.Srid)); } } else { for (int i = 0; i < values.Count; i++) { var c1 = values[i].Transform(p => sourceSrs.ToGeodetic <EsriPoint>(new EsriPoint() { X = p.X, Y = p.Y }), targetSrs.Srid); result.Add(c1.Transform(p => targetSrs.FromGeodetic <EsriPoint>(new EsriPoint() { X = p.X, Y = p.Y }, sourceSrs.Ellipsoid), targetSrs.Srid)); } } return(result); }