⚠️ Our 0.1 release refactored several early-development functions for long-term stability, to update your code see here. ⚠️
Future changes will come with deprecation warnings! 🙂




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

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.

  • i (Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) – Row (i) index of pixel.

  • j (Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) – 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[Any, dtype[Union[floating[Any], integer[Any]]]], ndarray[Any, dtype[Union[floating[Any], integer[Any]]]]]