geoutils.Raster.ij2xy

Contents

geoutils.Raster.ij2xy#

Raster.ij2xy(i, j, shift_area_or_point=None, force_offset=None)#

Get coordinates (x,y) of indexes (row,column).

By default, the indexes are shifted with the interpretation of pixel coordinates “AREA_OR_POINT” of the raster, to ensure that the indexes of points represent the right location. See parameter description of shift_area_or_point for more details.

This function is reversible with xy2ij for any pixel interpretation.

Parameters:
  • i (ArrayLike) – Row (i) index of pixel.

  • j (ArrayLike) – Column (j) index of pixel.

  • shift_area_or_point (bool | None) – Whether to shift with pixel interpretation, which shifts to center of pixel coordinates if self.area_or_point is “Point” and maintains corner pixel coordinate if it is “Area” or None. Defaults to True. Can be configured with the global setting geoutils.config[“shift_area_or_point”].

  • force_offset (str | None) – Ignore pixel interpretation and force coordinate to a certain offset: “center” of pixel, or any corner (upper-left “ul”, “ur”, “ll”, lr”). Default coordinate of a raster is upper-left.

Returns x, y:

x,y coordinates of i,j in reference system.

Return type:

tuple[ndarray[tuple[Any, ...], dtype[floating[Any] | integer[Any]]], ndarray[tuple[Any, ...], dtype[floating[Any] | integer[Any]]]]