restee
restee copied to clipboard
GeoPandas driver error
I believe I have set up everything correctly, but the following code:
import ee
ee.Initialize()
import restee as ree
# get an authenticated session with GCP for REST API calls
session = ree.EESession("<secret>","<super secret>")
# use ee to get a featurecollection for USA
countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
camerica= countries.filter(ee.Filter.eq("wld_rgn", "Central America"))
# define the domain imagery will be requested for
# in this case it is the computed USA featurecollection
domain = ree.Domain.from_ee_geometry(session,camerica,resolution=0.01)
gives the following error: DriverError: '/vsimem/5c2fb0daef8141bc9dc81453856ced7c' not recognized as a supported file format.
full traceback:
---------------------------------------------------------------------------
CPLE_OpenFailedError Traceback (most recent call last)
fiona/_shim.pyx in fiona._shim.gdal_open_vector()
fiona/_err.pyx in fiona._err.exc_wrap_pointer()
CPLE_OpenFailedError: '/vsimem/5c2fb0daef8141bc9dc81453856ced7c' not recognized as a supported file format.
During handling of the above exception, another exception occurred:
DriverError Traceback (most recent call last)
/tmp/ipykernel_3018/3436715166.py in <module>
13 # define the domain imagery will be requested for
14 # in this case it is the computed USA featurecollection
---> 15 domain = ree.Domain.from_ee_geometry(session,camerica,resolution=0.01)
16
17 # define some computations
~/miniconda3/envs/xaquacrop-dev/lib/python3.9/site-packages/restee/core.py in from_ee_geometry(session, geom, resolution)
231 response = session.send_request(url, payload)
232
--> 233 gdf = gpd.read_file(StringIO(response.content.decode()))
234
235 return Domain.from_geopandas(gdf, resolution=resolution)
~/miniconda3/envs/xaquacrop-dev/lib/python3.9/site-packages/geopandas/io/file.py in _read_file(filename, bbox, mask, rows, **kwargs)
199
200 with fiona_env():
--> 201 with reader(path_or_bytes, **kwargs) as features:
202
203 # In a future Fiona release the crs attribute of features will
~/miniconda3/envs/xaquacrop-dev/lib/python3.9/site-packages/fiona/collection.py in __init__(self, bytesbuf, **kwds)
553
554 # Instantiate the parent class.
--> 555 super(BytesCollection, self).__init__(self.virtual_file, vsi=filetype,
556 encoding='utf-8', **kwds)
557
~/miniconda3/envs/xaquacrop-dev/lib/python3.9/site-packages/fiona/collection.py in __init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs)
160 if self.mode == 'r':
161 self.session = Session()
--> 162 self.session.start(self, **kwargs)
163 elif self.mode in ('a', 'w'):
164 self.session = WritingSession()
fiona/ogrext.pyx in fiona.ogrext.Session.start()
fiona/_shim.pyx in fiona._shim.gdal_open_vector()
DriverError: '/vsimem/5c2fb0daef8141bc9dc81453856ced7c' not recognized as a supported file format.
where it is linked to this SO thread and it seems that for some reason response.content.decode results in a HTML page?