Example #1
0
        public static Extent Reproject(this Extent extent, ProjectionInfo srcProjection, ProjectionInfo destProjection)
        {
            Extent destExtent = extent.Copy();

            if (extent == null || srcProjection == null || destProjection == null || srcProjection.Equals(destProjection))
            {
                return(destExtent);
            }
            var xmin = extent.MinX;
            var xmax = extent.MaxX;
            var ymin = extent.MinY;
            var ymax = extent.MaxY;

            double[] z           = { 0, 0 };
            var      mapVertices = new[] { xmin, ymax, xmax, ymin };

            Projections.Reproject.ReprojectPoints(mapVertices, z, srcProjection, destProjection, 0, mapVertices.Length / 2);
            destExtent.MinX = mapVertices[0];
            destExtent.MinY = mapVertices[3];
            destExtent.MaxX = mapVertices[2];
            destExtent.MaxY = mapVertices[1];
            return(destExtent);
        }