Fixes a memoryfile issue with rasterio. When using f=json, it doesn't need to use the MemoryFile. (#1824)
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user