kmarkert / restee Goto Github PK
View Code? Open in Web Editor NEWPython package to call processed EE objects via the REST API to local data
Home Page: https://kmarkert.github.io/restee
License: MIT License
Python package to call processed EE objects via the REST API to local data
Home Page: https://kmarkert.github.io/restee
License: MIT License
Need to add in support for users to be able to request large areas. Right now if there are too many pixels being requested then it fails. We can chuck a domain into smaller domains for request and merge them all back together.
Right now the endpoint urls are hard coded at a couple of places (e.g. https://developers.google.com/earth-engine/cloud/highvolume?hl=en#using-the-high-volume-endpoint).
There needs to be an option to allow for the different api versions (i.e. v1alpha vs v1beta) as well as the high-volume endpoint to allow users different options when using package.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.