Skip to content

Fix NoData values for Coverage JSON output #2068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pygeoapi/provider/rasterio_.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import logging

import numpy as np
from pyproj import CRS, Transformer
import rasterio
from rasterio.io import MemoryFile
Expand Down Expand Up @@ -334,7 +335,10 @@ def gen_covjson(self, metadata, data):
'shape': [metadata['height'], metadata['width']],
}
# TODO: deal with multi-band value output
cj['ranges'][key]['values'] = data.flatten().tolist()
cj['ranges'][key]['values'] = [None if isinstance(v, float)
and np.isnan(v)
else v for v in
data.flatten().tolist()]
except IndexError as err:
LOGGER.warning(err)
raise ProviderQueryError('Invalid query parameter')
Expand Down