lonlat_to_xy#

geowombat.lonlat_to_xy(lon, lat, dst_crs)#

Converts from longitude and latitude to native map coordinates.

Parameters:
  • lon (float) – The longitude to convert.

  • lat (float) – The latitude to convert.

  • dst_crs (str, object, or DataArray) – The CRS to transform to. It can be provided as a string, a CRS instance (e.g., pyproj.crs.CRS), or a geowombat.DataArray.

Returns:

(x, y)

Return type:

tuple

Example

>>> import geowombat as gw
>>> from geowombat.core import lonlat_to_xy
>>>
>>> lon, lat = -55.56822206, -25.46214220
>>>
>>> with gw.open('image.tif') as src:
>>>     x, y = lonlat_to_xy(lon, lat, src)