public void Filter(GeoAPI.Geometries.Coordinate coord) { ProjNet.CoordinateSystems.ICoordinateSystem equalArea = (ProjNet.CoordinateSystems.ICoordinateSystem)CoordinateSystemWktReader.Parse(ProjectionUtil.NORTH_AMERICAN_ALBERS_EQUAL_AREA_WKT); ProjNet.CoordinateSystems.IGeographicCoordinateSystem latlon = (ProjNet.CoordinateSystems.IGeographicCoordinateSystem)CoordinateSystemWktReader.Parse(ProjectionUtil.GCS_WGS84_WKT); ICoordinateTransformationFactory ctfac = new CoordinateTransformationFactory(); ICoordinateTransformation transformation = ctfac.CreateFromCoordinateSystems(equalArea, latlon); double[] newCoords = transformation.MathTransform.Transform(new double[] { coord.X, coord.Y }); coord.X = newCoords[0]; coord.Y = newCoords[1]; }
public void Filter(GeoAPI.Geometries.Coordinate coord) { // TODO: Handle NotSupportedException for projections so // that we can offer the user a solution. ProjNet.CoordinateSystems.ICoordinateSystem fromCoordinateSystem = (ProjNet.CoordinateSystems.ICoordinateSystem)CoordinateSystemWktReader.Parse(projectionWkt); ProjNet.CoordinateSystems.IGeographicCoordinateSystem toLatLon = (ProjNet.CoordinateSystems.IGeographicCoordinateSystem)CoordinateSystemWktReader.Parse(SRID_4236); ProjNet.CoordinateSystems.Transformations.ICoordinateTransformationFactory ctfac = new CoordinateTransformationFactory(); ProjNet.CoordinateSystems.Transformations.ICoordinateTransformation transformation = ctfac.CreateFromCoordinateSystems(fromCoordinateSystem, toLatLon); //ICoordinateTransformation transformation = // ctfac.CreateFromCoordinateSystems() double[] newCoords = transformation.MathTransform.Transform(new double[] { coord.X, coord.Y }); coord.X = newCoords[0]; coord.Y = newCoords[1]; }