Skip to content

Commit

Permalink
fix invalid nodata overwriting
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Jan 12, 2024
1 parent f71940e commit b17c78a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 0.12.1 (2024-01-12)

* fix invalid nodata overwriting

# 0.12.0 (2024-01-12)

Expand Down
12 changes: 6 additions & 6 deletions rio_viz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def statistics(
):
"""Handle /stats requests."""
with self.reader(self.src_path) as src_dst:
if self.nodata is not None and dataset_params.nodata is not None:
if self.nodata is not None and dataset_params.nodata is None:
dataset_params.nodata = self.nodata

# Adapt options for each reader type
Expand Down Expand Up @@ -247,7 +247,7 @@ def point(
"""Handle /point requests."""
lon, lat = list(map(float, coordinates.split(",")))
with self.reader(self.src_path) as src_dst: # type: ignore
if self.nodata is not None and dataset_params.nodata is not None:
if self.nodata is not None and dataset_params.nodata is None:
dataset_params.nodata = self.nodata

# Adapt options for each reader type
Expand Down Expand Up @@ -289,7 +289,7 @@ def preview(
):
"""Handle /preview requests."""
with self.reader(self.src_path) as src_dst: # type: ignore
if self.nodata is not None and dataset_params.nodata is not None:
if self.nodata is not None and dataset_params.nodata is None:
dataset_params.nodata = self.nodata

# Adapt options for each reader type
Expand Down Expand Up @@ -361,7 +361,7 @@ def part(
):
"""Create image from part of a dataset."""
with self.reader(self.src_path) as src_dst: # type: ignore
if self.nodata is not None and dataset_params.nodata is not None:
if self.nodata is not None and dataset_params.nodata is None:
dataset_params.nodata = self.nodata

# Adapt options for each reader type
Expand Down Expand Up @@ -423,7 +423,7 @@ def geojson_part(
):
"""Handle /feature requests."""
with self.reader(self.src_path) as src_dst: # type: ignore
if self.nodata is not None and dataset_params.nodata is not None:
if self.nodata is not None and dataset_params.nodata is None:
dataset_params.nodata = self.nodata

# Adapt options for each reader type
Expand Down Expand Up @@ -510,7 +510,7 @@ def tile(
tilesize = tilesize or default_tilesize

with self.reader(self.src_path) as src_dst: # type: ignore
if self.nodata is not None and dataset_params.nodata is not None:
if self.nodata is not None and dataset_params.nodata is None:
dataset_params.nodata = self.nodata

# Adapt options for each reader type
Expand Down

0 comments on commit b17c78a

Please sign in to comment.