Skip to content

Commit

Permalink
Merge pull request #49 from acpaquette/latlon
Browse files Browse the repository at this point in the history
latlons
  • Loading branch information
tthatcher95 committed May 28, 2018
2 parents 55bc7c5 + 06d41a4 commit 9c02f60
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions plio/io/io_gdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,8 @@ def latlon_extent(self):
fp = self.footprint
# If we have a footprint, do not worry about computing a lat/lon transform
minx, maxx, miny, maxy = fp.GetEnvelope()
self._latlon_extent = [(minx, maxy),
(minx, miny),
(maxx, miny),
(maxx, maxy)]
self._latlon_extent = [(minx, miny),
(maxx, maxy)]
else:
self._latlon_extent = []
for x, y in self.xy_extent:
Expand All @@ -322,6 +320,25 @@ def latlon_extent(self):
self._latlon_extent.append((x,y))
return self._latlon_extent

@property
def latlon_corners(self):
if not getattr(self, '_latlon_corners', None):
if self.footprint:
fp = self.footprint

minx, maxx, miny, maxy = fp.GetEnvelope()
self._latlon_corners = [(minx, maxy),
(minx, miny),
(maxx, miny),
(maxx, maxy)]
else:
self._latlon_corners = []
for x, y in self.xy_corners:
x, y = self.pixel_to_latlon(x,y)

self._latlon_corners.append((x,y))
return self._latlon_corners

@property
def xy_extent(self):
return [(0, 0),
Expand Down

0 comments on commit 9c02f60

Please sign in to comment.