Skip to content

Commit

Permalink
Merge pull request #4229 from camptocamp/fix-profile
Browse files Browse the repository at this point in the history
Don't break the profile on wrong data
  • Loading branch information
sbrunner authored Oct 26, 2018
2 parents 5930a50 + c5249f0 commit 1b3773a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion geoportal/c2cgeoportal_geoportal/views/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ def _get_raster_value(self, layer, lon, lat):
dataset, band = self._get_raster(path)

index = dataset.index(lon, lat)
result = band[index[0] - 1][index[1] - 1]
if index[0] - 1 < len(band) or index[1] - 1 < len(band[index[0] - 1]):
result = band[index[0] - 1][index[1] - 1]
else:
log.warning("Unable to get value for layer: {}, lon: {}, lat: {}, in {}.".format(
layer, lon, lat, path
))
result = None

if "round" in layer:
result = self._round(result, layer["round"])
Expand Down

0 comments on commit 1b3773a

Please sign in to comment.