public static PrjEnvelope GetEnvelope(float[] srcXs, float[] srcYs, ISpatialReference dstSpatialRef, Action <int, string> progressCallback) { if (dstSpatialRef == null) { dstSpatialRef = SpatialReference.GetDefault(); } PrjEnvelope maskEnvelope = new PrjEnvelope(double.MinValue, double.MaxValue, double.MinValue, double.MaxValue); bool isLatLong = (dstSpatialRef.ProjectionCoordSystem == null && dstSpatialRef.GeographicsCoordSystem != null); if (isLatLong)//投影目标是地理坐标 { //maskEnvelope = new PrjEnvelope(-180, 180, -90, 90); maskEnvelope = new PrjEnvelope(-145, 180, -75, 75); } else { ; } //其他投影范围未实现 PrjEnvelope dstEnvelope = PrjEnvelope.GetEnvelope(srcXs, srcYs, maskEnvelope); return(dstEnvelope); }
/// <summary> /// 这里面的去除噪声数据的处理,会影响到全球拼图处理中数据跨越+-180度数据的正确经纬度设置。 /// </summary> /// <param name="srcXs"></param> /// <param name="srcYs"></param> /// <param name="maskEnvelope"></param> /// <param name="dstSpatialRef"></param> /// <param name="progressCallback"></param> /// <returns></returns> public static PrjEnvelope GetEnvelope(double[] srcXs, double[] srcYs, PrjEnvelope maskEnvelope, ISpatialReference dstSpatialRef, Action <int, string> progressCallback) { if (dstSpatialRef == null) { dstSpatialRef = SpatialReference.GetDefault(); } bool isLatLong = (dstSpatialRef.ProjectionCoordSystem == null && dstSpatialRef.GeographicsCoordSystem != null); double noise = 0d; if (maskEnvelope == null) { noise = 0.001d; if (isLatLong && maskEnvelope == null)//投影目标是地理坐标 { maskEnvelope = new PrjEnvelope(-180, 180, -90, 90); //maskEnvelope = new PrjEnvelope(-145, 180, -75, 75); } else { maskEnvelope = new PrjEnvelope(double.MinValue, double.MaxValue, double.MinValue, double.MaxValue); ;//... } } PrjEnvelope dstEnvelope = PrjEnvelope.GetEnvelope(srcXs, srcYs, maskEnvelope); bool spans180thMeridian = maskEnvelope.Width - dstEnvelope.Width < 0.011d; //(这里应当传入角度分辨率) if (spans180thMeridian) //跨越180度数据,不再去除噪声数据。 { dstEnvelope.MinX = maskEnvelope.MinX; dstEnvelope.MaxX = maskEnvelope.MaxX; } else if (noise != 0d)//可以去除0.1%以下的噪声数据 { dstEnvelope.MinX = dstEnvelope.MinX + dstEnvelope.Width * noise; dstEnvelope.MaxX = dstEnvelope.MaxX - dstEnvelope.Width * noise; dstEnvelope = PrjEnvelope.GetEnvelope(srcXs, srcYs, dstEnvelope); } return(dstEnvelope); }