ds.rst.coords() or Raster.coords()

ds.rst.coords() or Raster.coords()#

RasterBase.coords(grid=True, shift_area_or_point=None, force_offset=None, crs=None)[source]#

Get coordinates (x,y) of all pixels in the raster.

Parameters:
  • grid (bool) – Whether to return coordinate matrix, otherwise only X/Y axis coordinates. Required for rotated rasters where X/Y axis coordinates do not suffice to represent grid coordinates.

  • 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.

  • crs (CRS | int | None) – Coordinate reference system in which the coordinates are provided. Defaults to CRS of the input raster.

Returns x,y:

Arrays of the (x,y) coordinates.

Return type:

tuple[NDArray[floating[Any] | integer[Any]], NDArray[floating[Any] | integer[Any]]]