From b17c78abe5027c87c534177330ce1cc9d0552419 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Fri, 12 Jan 2024 10:28:47 +0100 Subject: [PATCH] fix invalid nodata overwriting --- CHANGES.md | 3 +++ rio_viz/app.py | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index bbc63ea..f026aff 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,6 @@ +# 0.12.1 (2024-01-12) + +* fix invalid nodata overwriting # 0.12.0 (2024-01-12) diff --git a/rio_viz/app.py b/rio_viz/app.py index 83043aa..dafa64b 100644 --- a/rio_viz/app.py +++ b/rio_viz/app.py @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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