coords_to_indices#

geowombat.coords_to_indices(x, y, transform)#

Converts map coordinates to array indices.

Parameters:
  • x (float or 1d array) – The x coordinates.

  • y (float or 1d array) – The y coordinates.

  • transform (object) – The affine transform.

Returns:

(col_index, row_index)

Return type:

tuple

Example

>>> import geowombat as gw
>>> from geowombat.core import coords_to_indices
>>>
>>> with gw.open('image.tif') as src:
>>>     j, i = coords_to_indices(x, y, src)