Fixes a memoryfile issue with rasterio. When using f=json, it doesn't need to use the MemoryFile. (#1824)

This commit is contained in:
Alex
2024-10-03 09:21:05 -04:00
committed by GitHub
parent e736fa3b2f
commit 179c90ff31
+8 -9
View File
@@ -240,16 +240,15 @@ class RasterioProvider(BaseProvider):
out_meta['units'] = _data.units
LOGGER.debug('Serializing data in memory')
with MemoryFile() as memfile:
with memfile.open(**out_meta) as dest:
dest.write(out_image)
if format_ == 'json':
LOGGER.debug('Creating output in CoverageJSON')
out_meta['bands'] = args['indexes']
return self.gen_covjson(out_meta, out_image)
if format_ == 'json':
LOGGER.debug('Creating output in CoverageJSON')
out_meta['bands'] = args['indexes']
return self.gen_covjson(out_meta, out_image)
else: # return data in native format
else: # return data in native format
with MemoryFile() as memfile:
with memfile.open(**out_meta) as dest:
dest.write(out_image)
LOGGER.debug('Returning data in native format')
return memfile.read()