Crs.MetersXY Method
MetersXY(Point point)
Returns local conversion factors between true meters and the length unit of the projection.Syntax
public Point MetersXY (
Point point
)
Parameters
Return Value
Remarks
This method gives the relation between Crs coordinates and true meters near a given (projected) point, which depends on both the local scale factors and the choice of length unit in the projection. (But it does not depend on the current scale: Crs coordinates are unchanged during a zoom, unlike pixel coordinates.) The method returns an x value and a y value (as parts of a Point). To convert a short distance, parallel to the x-axis (or the y-axis) of the Crs and near the given point, to meters, you can multiply the distance (expressed in Crs coordinates) by the returned x value (or the y value).
For an oblique distance, you can use the theorem of Pythagoras, which says that the distance = sqrt(dx*dx+dy*dy), but only if the x- and y-directions are at right angles in real life (not just on the map). This is true for conformal projections, and for cylindrical projections in equatorial aspect, but not generally: it is false for the OrthographicProjection, for example. But to compute distances, it is easier to use the Length method; MetersXY is appropriate if you need the local scale factors at a given point.
With metersXY, the scale can be calculated if the ratio between presented length and length in the reference system in known.
Platforms
Windows, Linux, Android