convert_bin_grid

geodetic_engine.bingrid.convert_bin_grid(corners, crs, *, target_crs=None, operation=None, scale_factor=None, increment_i=1, increment_j=1, wgs84=True, wgs84_operation=None, coordinate_epoch=None)[source]

Check a four-corner bin grid, optionally convert it, and square it up.

Parameters:
  • corners (BinGridCorners | Iterable[BinGridCorner | tuple[int, int, float, float]]) – The four corners, in any order.

  • crs (Any) – CRS the corners’ coordinates are in; anything from_user_input() accepts. Must be projected, optionally bound.

  • target_crs (Any, default: None) – CRS to convert the grid to. Omitted, or on the same map grid as crs – the same datum, projection and linear unit, whatever the axis order and whether or not either is bound – the grid is squared up where it is; a bound target_crs then names the operation to WGS 84, an unbound one leaves the grid’s own CRS in place.

  • operation (Any, default: None) – Coordinate operation for the conversion to target_crs, as Transformation takes it. Needed when the conversion changes datum and neither CRS is bound.

  • scale_factor (float | None, default: None) – Bin grid scale factor of the squared grid. Omitted, it is the point scale factor of the CRS the grid is squared in, at the grid centre (point_scale_factor), so that the bin widths are the ground spacing of the bins there. Required where that CRS’s projection is not conformal at the grid, or its geographic CRS states its axes in different units.

  • increment_i (int, default: 1) – Inline node increment.

  • increment_j (int, default: 1) – Crossline node increment.

  • wgs84 (bool, default: True) – Whether to also give the squared corners in WGS 84.

  • wgs84_operation (Any, default: None) – Coordinate operation to WGS 84, when the grid’s CRS does not state one.

  • coordinate_epoch (float | None, default: None) – Decimal year the coordinates were observed at, for a conversion whose operation reads it, as transform() takes it.

Return type:

BinGridResult

Returns:

The squared grid with its provenance.

Raises:
  • InvalidCornersError – If the corners are not those of a bin grid, or their spans are not multiples of the node increments.

  • DegenerateBinGridError – If their coordinates cannot be.

  • InvalidParameterError – If a parameter is out of range.

  • UnsupportedCRSError – If a CRS cannot carry a bin grid, or scale_factor is omitted and cannot be derived: the projection is not conformal at the grid, or its geographic CRS states its axes in different units.

  • ValueError – If operation is given without a conversion to apply it to, or wgs84_operation with wgs84=False.

  • geodetic_engine.geodesy.GeodesyError – If a conversion cannot be resolved or applied, for example a datum change that names no operation.