Projection factors¶
A map projection turns directions and stretches distances, by an amount that
changes from point to point.
projection_factors() reports how much, at any
point of a projected CRS:
the grid convergence, the angle between true north and grid north;
the point scale factor, a short distance on the grid over the same distance on the ellipsoid;
the meridional scale, the areal scale and the angular distortion.
Use the grid convergence to turn an azimuth between true north and grid north,
and the scale factor to scale a distance between the ellipsoid and the grid.
The values are PROJ’s, from Proj.get_factors().
Conventions¶
Value |
Meaning |
|---|---|
|
The angle from true north to grid north, in degrees, positive clockwise. On a conformal projection, \(\alpha_{grid} = \alpha_{true} - \gamma\). |
|
Grid distance over ellipsoid distance, along the parallel. On a conformal projection it is the same in every direction. |
|
The same along the meridian. Equal to \(k\) on a conformal projection. |
|
Grid area over ellipsoid area. 1 on an equal-area projection. |
|
The most the projection changes an angle, in degrees. 0 on a conformal projection. |
Points are in xy order and in the CRS’s own units, or longitude and latitude
with geographic=True. A third value per point, such as a height, is ignored.
At one point¶
from geodetic_engine.geodesy import projection_factors
factors = projection_factors("EPSG:32631", (600000.0, 6700000.0))
print("grid convergence :", factors.grid_convergence)
print("scale factor :", factors.scale_factor)
print("angular distortion:", factors.angular_distortion)
print("longitude :", factors.longitude)
print("latitude :", factors.latitude)
grid convergence : [1.57974221]
scale factor : [0.99972254]
angular distortion: [0.]
longitude : [4.81627121]
latitude : [60.4238988]
Every value is an array with one entry per point. The point is 100 km east of the central meridian of UTM zone 31N, so grid north lies clockwise of true north and the convergence is positive. UTM is conformal, so the angular distortion is zero.
At many points¶
Give one row per point, as a list of tuples or a numpy array:
import numpy as np
import pandas as pd
eastings = np.arange(350000.0, 650001.0, 50000.0)
points = np.column_stack([eastings, np.full(len(eastings), 6650000.0)])
across = projection_factors("EPSG:32631", points)
pd.DataFrame(
{
"easting": eastings,
"grid_convergence": across.grid_convergence,
"scale_factor": across.scale_factor,
}
).style.hide(axis="index").format(precision=6).format("{:.0f}", subset="easting")
| easting | grid_convergence | scale_factor |
|---|---|---|
| 350000 | -2.326064 | 0.999876 |
| 400000 | -1.551341 | 0.999723 |
| 450000 | -0.775860 | 0.999631 |
| 500000 | -0.000000 | 0.999600 |
| 550000 | 0.775860 | 0.999631 |
| 600000 | 1.551341 | 0.999723 |
| 650000 | 2.326064 | 0.999876 |
The convergence changes sign at the central meridian (easting 500 000 m). The scale factor is smallest there, 0.9996, and grows towards the zone’s edges.
From longitude and latitude¶
With geographic=True the points are longitude and latitude in the CRS’s own
geographic CRS:
at_position = projection_factors("EPSG:32631", (6.0, 60.0), geographic=True)
print("grid convergence:", at_position.grid_convergence)
print("scale factor :", at_position.scale_factor)
grid convergence: [2.59867269]
scale factor : [0.999943]
Turning azimuths¶
Grid north lies \(\gamma\) clockwise of true north, so
East of the central meridian, on the left, \(\gamma\) is positive. West of it, on the right, \(\gamma\) is negative. The figure exaggerates the angle: across a UTM zone it is never more than about 3°.
to_grid_azimuth() and
to_true_azimuth() apply this,
in degrees, and return values in \([0°, 360°)\):
print("grid convergence:", at_position.grid_convergence)
print("true 90 on grid :", at_position.to_grid_azimuth(90.0))
print("grid 90 is true :", at_position.to_true_azimuth(90.0))
grid convergence: [2.59867269]
true 90 on grid : [87.40132731]
grid 90 is true : [92.59867269]
With factors at several points, one azimuth is turned at every point, or one azimuth per point is turned at its own point.
To check the sign, project two points on the same meridian onto the grid. The line between them points to true north, and on the grid it lies at azimuth \(-\gamma\):
import math
from geodetic_engine.geodesy import Transformation
to_grid = Transformation("EPSG:4326", "EPSG:32631")
(x1, y1), (x2, y2) = to_grid.transform([(6.0, 60.0), (6.0, 60.0001)]).coordinates
bearing = math.degrees(math.atan2(x2 - x1, y2 - y1))
print(f"grid azimuth of true north: {bearing:.6f}")
print(f"minus grid convergence : {-at_position.grid_convergence[0]:.6f}")
grid azimuth of true north: -2.598674
minus grid convergence : -2.598673
Scaling distances¶
The scale factor relates a short distance on the ellipsoid to the same distance on the grid:
To check it, measure a short line both ways and compare the ratio with \(k\):
from pyproj import Geod
west, east = (5.995, 60.0), (6.005, 60.0)
_, _, on_ellipsoid = Geod(ellps="WGS84").inv(*west, *east)
(xw, yw), (xe, ye) = to_grid.transform([west, east]).coordinates
on_grid = math.hypot(xe - xw, ye - yw)
print(f"grid / ellipsoid: {on_grid / on_ellipsoid:.10f}")
print(f"scale factor : {at_position.scale_factor[0]:.10f}")
grid / ellipsoid: 0.9999429956
scale factor : 0.9999429952
Note
The scale factor relates the grid to the ellipsoid, not to the ground. A distance measured at a height above the ellipsoid must first be reduced to the ellipsoid. This package does not apply that elevation factor.
Across a zone¶
The factors change from point to point. The figures below show them across UTM zone 31N (central meridian 3°E), from the equator to 84°N.
The grid convergence is zero along the central meridian (dotted) and along the equator. It grows with the distance from the central meridian and with latitude, to about ±3° at the zone’s edges near the pole. Mixing up grid north and true north there puts a position about 50 m sideways for every kilometre travelled.
The scale factor is 0.9996 on the central meridian, where a grid distance is 0.04 % shorter than on the ellipsoid. It grows towards the zone’s edges, and reaches 1 about 180 km either side of the central meridian. It depends almost only on the distance from the central meridian, so one curve fits every latitude:
Using the values from one point over a long distance carries their change along. The grid north local method in Georeferencing methods uses the values at the wellhead for the whole well, which is why it drifts as the reach grows.
Which part of the CRS is used¶
A compound CRS is read through its horizontal part.
A bound CRS is read through its base CRS. Its binding changes the datum, not the projection.
A geographic CRS has no grid. The convergence is 0, every scale is 1, and
projectedis False.Geocentric, engineering and vertical CRSs have no projection factors and are refused.
compound = projection_factors("EPSG:6172", (600000.0, 7000000.0, 120.0))
geographic = projection_factors("EPSG:4326", (6.0, 60.0))
print(compound.horizontal_crs.name, compound.grid_convergence)
print(geographic.projected, geographic.grid_convergence, geographic.scale_factor)
ETRS89-NOR [EUREF89] / UTM zone 32N [1.76819927]
False [0.] [1.]
The CRS’s units do not change the factors. Longitude and latitude are read in the geographic CRS’s own unit and from its own prime meridian, as PROJ reads them, so NTF (Paris) in grads from Paris works too.
Projections that are not conformal¶
An equal-area projection such as EPSG:3035 (LAEA Europe) keeps areas and
changes angles. The scales along the parallel and the meridian differ, and the
angular distortion is not zero:
laea = projection_factors("EPSG:3035", (5500000.0, 4500000.0))
print("scale factor :", laea.scale_factor)
print("meridional scale :", laea.meridional_scale)
print("areal scale :", laea.areal_scale)
print("angular distortion:", laea.angular_distortion)
scale factor : [0.99496097]
meridional scale : [1.00519998]
areal scale : [1.]
angular distortion: [1.1084936]
There, turning an azimuth by the convergence alone gives the wrong answer.
conformal says so, and the
azimuth helpers refuse:
print("conformal:", laea.conformal)
laea.to_grid_azimuth(45.0)
conformal: False
UnsupportedCRSError: ETRS89-extended / LAEA Europe does not preserve angles here; scale factor and grid convergence need a conformal projection
Web Mercator (EPSG:3857) uses a spherical formula on the WGS 84 ellipsoid,
so it is not conformal either. Its factors are reported on the ellipsoid, and
its azimuths are refused the same way.
As JSON¶
to_json_dict() gives plain
data, one entry per point, with the sign convention written out:
import json
print(json.dumps(factors.to_json_dict(), indent=2))
{
"crs": "EPSG:32631",
"geographic_crs": "EPSG:4326",
"projected": true,
"coordinates_crs": "EPSG:32631",
"coordinate_order": "xy",
"angle_unit": "degree",
"convention": "grid_convergence is the clockwise angle from true north to grid north for a conformal projection; grid azimuth = true azimuth - grid_convergence. scale_factor is the parallel scale k; grid distance = k * ellipsoidal distance along the parallel, or in every direction for conformal projections.",
"points": [
{
"coordinates": [
600000.0,
6700000.0
],
"longitude": 4.816271214282703,
"latitude": 60.42389879597797,
"grid_convergence": 1.5797422095239795,
"scale_factor": 0.9997225382144919,
"meridional_scale": 0.999722538249789,
"areal_scale": 0.9994451534493135,
"angular_distortion": 0.0
}
]
}
What is refused¶
UnsupportedCRSError for a CRS with no
projected or geographic horizontal part:
projection_factors("EPSG:4978", (3194419.0, 194311.0, 5470000.0)) # geocentric
UnsupportedCRSError: EPSG:4978 has no map projection or geographic horizontal part, so it has no projection factors
CoordinateOutOfRangeError for a point out of
range, and its base class
TransformationFailedError for one that is not
finite or is at a pole:
projection_factors("EPSG:32631", (6.0, 95.0), geographic=True)
CoordinateOutOfRangeError: longitude or latitude is outside the range of WGS 84
A ValueError for points that are not two or three values each.