Skip to content

Commit

Permalink
Follow up to #2845
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillies committed Jun 16, 2023
1 parent 8b2ce55 commit 763db0a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions rasterio/_base.pyx
Expand Up @@ -1042,16 +1042,17 @@ cdef class DatasetBase:
return m

def lnglat(self) -> tuple[float, float]:
"""Geographic coordinates of center of raster.
"""Geographic coordinates of the dataset's center.

Returns
-------
(longitude, latitude) of centroid.

Returns:
(longitude, latitude) of centroid.
"""
w, s, e, n = self.bounds
cx = (w + e)/2.0
cy = (s + n)/2.0
lng, lat = _transform(
self.crs, {'init': 'epsg:4326'}, [cx], [cy], None)
cx = (w + e) / 2.0
cy = (s + n) / 2.0
lng, lat = _transform(self.crs, "EPSG:4326", [cx], [cy], None)
return lng.pop(), lat.pop()

def _get_crs(self):
Expand Down

0 comments on commit 763db0a

Please sign in to comment.