public void TestConversionDSProjection() { var pi1 = DotSpatial.Projections.ProjectionInfo.FromEsriString(Osgb36); var pi2 = DotSpatial.Projections.ProjectionInfo.FromEsriString(WGS84); var ct = new DotSpatial.Projections.CoordinateTransformation(); ct.Source = pi1; ct.Target = pi2; }
public void TestConversionDSProjection() { var pi1 = DotSpatial.Projections.ProjectionInfo.FromEsriString(Osgb36); var pi2 = DotSpatial.Projections.ProjectionInfo.FromEsriString(WGS84); var ct = new DotSpatial.Projections.CoordinateTransformation(); ct.Source = pi1; ct.Target = pi2; }
private Envelope GetEnvelope() { var boxes = new Collection<Envelope>(); var sridBoxes = getBoundingBoxes(RootLayer); foreach (var sridBox in sridBoxes) { if (SRID == sridBox.SRID) boxes.Add(sridBox); } if (boxes.Count > 0) { var res = new Envelope(); foreach (var envelope in boxes) res.ExpandToInclude(envelope); return res; } if (SRID == 4326) return RootLayer.LatLonBoundingBox; try { var projection = this.GetCoordinateSystem(); if (projection == null) { Logger.Warn("WmsLayer envelope is null because there is no Coordinate System found for SRID " + SRID); return null; } #if !DotSpatialProjections var wgs84 = GeographicCoordinateSystem.WGS84; var ctf = new CoordinateTransformationFactory(); var transformation = ctf.CreateFromCoordinateSystems(wgs84, projection); #else var wgs84 = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984; var transformation = new DotSpatial.Projections.CoordinateTransformation { Source = wgs84, Target = projection }; #endif return ToTarget(RootLayer.LatLonBoundingBox, transformation); } catch (Exception e) { Logger.Warn("Error calculating Envelope Transformation from WGS84 to SRID " + SRID, e); return null; } }
private Envelope GetEnvelope() { var boxes = new Collection <Envelope>(); var sridBoxes = getBoundingBoxes(RootLayer); foreach (var sridBox in sridBoxes) { if (SRID == sridBox.SRID) { boxes.Add(sridBox); } } if (boxes.Count > 0) { var res = new Envelope(); foreach (var envelope in boxes) { res.ExpandToInclude(envelope); } return(res); } if (SRID == 4326) { return(RootLayer.LatLonBoundingBox); } try { var projection = this.GetCoordinateSystem(); if (projection == null) { Logger.Warn("WmsLayer envelope is null because there is no Coordinate System found for SRID " + SRID); return(null); } #if !DotSpatialProjections var wgs84 = GeographicCoordinateSystem.WGS84; var ctf = new CoordinateTransformationFactory(); var transformation = ctf.CreateFromCoordinateSystems(wgs84, projection); #else var wgs84 = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984; var transformation = new DotSpatial.Projections.CoordinateTransformation { Source = wgs84, Target = projection }; #endif return(ToTarget(RootLayer.LatLonBoundingBox, transformation)); } catch (Exception e) { Logger.Warn("Error calculating Envelope Transformation from WGS84 to SRID " + SRID, e); return(null); } }