Crs.FromArea Methods
Returns a new Coordinate Reference System, suitable for a given rectangular area.
Overload List
Name | Description | |
---|---|---|
FromArea(Point longLatSW, Point longLatNE, GeodeticDatum geodeticDatum) | Returns a new Coordinate Reference System with a conformal projection, suitable for a given rectangular area. | |
FromArea(Rectangle area, Crs crs, ProjectionType projectionType) | Returns a new Coordinate Reference System with a certain projection type, suitable for a given rectangular area. |
FromArea(Point longLatSW, Point longLatNE, GeodeticDatum geodeticDatum)
Returns a new Coordinate Reference System with a conformal projection, suitable for a given rectangular area.Syntax
public static Crs FromArea (
Point longLatSW,
Point longLatNE,
GeodeticDatum geodeticDatum
)
Parameters
The southwest corner of the area, expressed in LongLat.
The northeast corner of the area, expressed in LongLat.
Return Value
A Crs suitable for the given area.
Remarks
The new Coordinate Reference System will have a conformal projection with coordinates in meters, suitable for the given rectangular area.
Such a projection lets your application calculate in plane geometry (perhaps by using the Geometry classes). If the rectangle is sufficiently small, a conformal projection is almost perfect in other respects as well: its scale will be almost constant, great circle routes will appear almost straight, areas of polygons will be almost correct, etc. For larger rectangles, the accuracy decreases, but it is tricky to say when it becomes too bad. It depends on your accuracy requirements and the nature of the plane geometry calculations. For some purposes, a non-conformal projection would be better for large rectangles - for example, you can use a azimuthal equal-area projection if you want to compute areas of large polygons.
To specify an area that crosses the 180° meridian, specify the first point with a longitude numerically greater than the longitude of the second.
The FromArea overload, and the FromFeature and FromFeatures methods also create new Crs instances with certain properties and may be easier to use.
FromArea(Rectangle area, Crs crs, ProjectionType projectionType)
Returns a new Coordinate Reference System with a certain projection type, suitable for a given rectangular area.Syntax
public static Crs FromArea (
Rectangle area,
Crs crs,
ProjectionType projectionType
)
Parameters
The area of interest.
The Coordinate Reference System in which area is specified.
The desired type of projection used by the returned Coordinate Reference System.
Return Value
A Crs suitable for the given area.
Remarks
The new Coordinate Reference System will have either a conformal, equal-area or equidistant projection with coordinates in meters, suitable for the given area. It will use the same geodetic datum as crs.
If the rectangle is sufficiently small, a conformal projection is almost perfect in other respects as well: its scale will be almost constant, great circle routes will appear almost straight, areas of polygons will be almost correct, etc. For larger rectangles, the accuracy decreases, but it is tricky to say when it becomes too bad. It depends on your accuracy requirements and the nature of the plane geometry calculations. For some purposes, a non-conformal projection would be better for large rectangles - for example, use EqualArea if you want to compute areas of large polygons.
Always specify a rectangle with xMin < xMax and yMin < yMax. To specify an area that crosses the interrupted meridian of a cylindric projection like Mercator or LongLat (usually the 180° meridian), you can specify a rectangle with xMax greater than xMax of the projection bounds.
If the rectangle can't be unprojected to one or more longitude/latitude areas, an exception will be thrown.
Platforms
Windows, Linux, Android