giswqs / geemap Goto Github PK
View Code? Open in Web Editor NEWA Python package for interactive geospatial analysis and visualization with Google Earth Engine.
Home Page: https://geemap.org
License: MIT License
A Python package for interactive geospatial analysis and visualization with Google Earth Engine.
Home Page: https://geemap.org
License: MIT License
I am using JupyterLab a to run notebook example 21_export_map_to_html_png.ipynb and do not see an export (wrench) icon on my map.
When I try to run the provided code using Map.to_html and Map.to_image I get AttributeError: 'Map' object has no attribute 'to_html'.
These two issues happen on both jupyter notebook and Jupyter Lab
Map = geemap.Map()
Map
# Add Earth Engine datasets
dem = ee.Image('USGS/SRTMGL1_003')
landcover = ee.Image("ESA/GLOBCOVER_L4_200901_200912_V2_3").select('landcover')
landsat7 = ee.Image('LE7_TOA_5YEAR/1999_2003')
states = ee.FeatureCollection("TIGER/2018/States")
# Set visualization parameters.
vis_params = {
'min': 0,
'max': 4000,
'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']}
# Add Earth Eninge layers to Map
Map.addLayer(dem, vis_params, 'STRM DEM', True, 0.5)
Map.addLayer(landcover, {}, 'Land cover')
Map.addLayer(landsat7, {'bands': ['B4', 'B3', 'B2'], 'min': 20, 'max': 200}, 'Landsat 7')
Map.addLayer(states, {}, "US States")
*see no icon*
#export map as html
import os
#declare where to download output
download_dir = os.path.join(os.path.expanduser('~'), 'Downloads')
html_file = os.path.join(download_dir, 'my_map.html')
Map.to_html(outfile=html_file, title='My Map', width='100%', height='880px')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-28-63cbb236e2de> in <module>
----> 1 Map.to_html(outfile=html_file, title='My Map', width='100%', height='880px')
AttributeError: 'Map' object has no attribute 'to_html'
Add a function for computing zonal statistics for integer image. For example, calculating the land cover composition of each country/state.
Hi, I'm following your your install instructions (01 Introducing the geemp.. video). But I keep getting this ipyleaflet error at the first step when importing geemap (in Jupyter Notebook).
import geemap
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-e6047112adad> in <module>
----> 1 import geemap
~\anaconda3\envs\gee2\lib\site-packages\geemap\__init__.py in <module>
5 __version__ = '0.6.10'
6
----> 7 from .geemap import *
8 from .basemaps import ee_basemaps
9 from .legends import builtin_legends
~\anaconda3\envs\gee2\lib\site-packages\geemap\geemap.py in <module>
13 from ipyleaflet import *
14 from IPython.display import display
---> 15 from .basemaps import ee_basemaps
16 from .conversion import *
17 from .legends import builtin_legends
~\anaconda3\envs\gee2\lib\site-packages\geemap\basemaps.py in <module>
----> 1 from ipyleaflet import TileLayer, WMSLayer, basemaps, basemap_to_tiles
2
3 # More WMS basemaps can be found at the following websites:
4 # USGS National Map: https://viewer.nationalmap.gov/services/
5 # MRLC NLCD Land Cover data: https://viewer.nationalmap.gov/services/
ImportError: cannot import name 'TileLayer' from 'ipyleaflet' (C:\Users\RMain\anaconda3\envs\gee2\lib\site-packages\ipyleaflet\__init__.py)
I followed the directions in example 11 to download an image collection. When using the supplied USDA/NAIP/DOQQ
dataset, the export succeeds. When replacing the dataset with my desired NASA/OCEANDATA/MODIS-Aqua/L3SMI
the export fails with the error:
Exporting 1/4: A2016153.tif
Generating URL ...
An error occurred while downloading.
Image.clipToBoundsAndScale: The geometry for image clipping must be bounded.
# Define a point of interest
aoi = ee.Geometry.Point(-99.2222, 46.7816)
# Define an image.
img_coll = ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI') \
.filterDate('2016-06-01', '2016-06-05') \
.select(['Rrs_645', 'Rrs_555', 'Rrs_443']) \
.filterBounds(aoi)
out_dir='sample_data'
geemap.ee_export_image_collection(img_coll, out_dir=out_dir)
Running the notebook 09_plotting.ipynb. "Use Plotting" works partly but the display of the time series fails.
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
jupyter labextension list
JupyterLab v2.0.0
Known labextensions:
app dir: /home/xxxyyy/anaconda3/envs/sv/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
jupyter-leaflet v0.12.4 enabled OK
Figured out on a hunch bqplot extensions were not registered.
Do jupyter labextension install bqplot
then jupyter labextension list
outputs:
JupyterLab v2.0.0
Known labextensions:
app dir: /home/xxxyyy/anaconda3/envs/sv/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
bqplot v0.5.10 enabled OK
jupyter-leaflet v0.12.4 enabled OK
After you restart jupyter-lab
:
I am following notebook example 19_search_places_and_datasets.ipynb and am having trouble importing a dataset from the interactive map
When I press import after searching for a dataset, nothing happens. The chunk of code does not print under the map.
Following the landsat_timeseries function create a sentinel_timeseries function.
Hi Dr. Wu,
Following issues arose when I ran the function below:
add_text_to_gif(in_gif, out_gif, xy=('3%', '88%'), text_sequence=dates, font_size=20, font_color='white', duration=1000)
I attached both the original gif and the output gif.
Please help!
Thank you
Zhe
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
In addition to adding animated text to a GIF image created from Earth Engine data, this will allow users to add a logo or watermark to the the GIF image.
Describe what you were trying to get done:
I cannot launch jupyter notebook in gee environment.
Also, I cannot import geemap.
I installed both anaconda 2 and 3, would that be the possible reason for the problem?
(gee) PS C:\WINDOWS\system32> jupyter notebook Traceback (most recent call last):
File "C:\Users\irisr\.conda\envs\gee\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\ProgramData\Anaconda3\Lib\site-packages\notebook\notebookapp.py", line 47, in <module>
from zmq.eventloop import ioloop
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\cython\__init__.py)
>>> import geemap
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\irisr\.conda\envs\gee\lib\site-packages\geemap\__init__.py", line 7, in <module>
from .geemap import *
File "C:\Users\irisr\.conda\envs\gee\lib\site-packages\geemap\geemap.py", line 10, in <module>
import ipywidgets as widgets
File "C:\ProgramData\Anaconda3\Lib\site-packages\ipywidgets\__init__.py", line 25, in <module>
from .widgets import *
File "C:\ProgramData\Anaconda3\Lib\site-packages\ipywidgets\widgets\__init__.py", line 4, in <module>
from .widget import Widget, CallbackDispatcher, register, widget_serialization
File "C:\ProgramData\Anaconda3\Lib\site-packages\ipywidgets\widgets\widget.py", line 15, in <module>
from ipykernel.comm import Comm
File "C:\ProgramData\Anaconda3\Lib\site-packages\ipykernel\__init__.py", line 2, in <module>
from .connect import *
File "C:\ProgramData\Anaconda3\Lib\site-packages\ipykernel\connect.py", line 18, in <module>
import jupyter_client
File "C:\ProgramData\Anaconda3\Lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\ProgramData\Anaconda3\Lib\site-packages\jupyter_client\connect.py", line 23, in <module>
import zmq
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (C:\ProgramData\Anaconda3\Lib\site-packages\zmq\backend\cython\__init__.py)
I tried to install gee using conda on an existing virtual instance and display the map.
The output of the cell Map
is just blank. There are no errors.
import geemap
Map = geemap.Map(center=[40,-100], zoom=4)
Map
output of the last cell is just blank. Maybe I need a clean install but wanted to flag anyway
It would be nice if geemap users can automatically convert shapefiles to Earth Engine objects without having to upload shapefiles to Earth Engine cloud.
Google colab with pip install
I clicked on the Google colab button in the repo, opened it and ran it. geemap.eefolium did give me back a map, but the standard geemap not. Since I would like to use the advanced features of split map etc, I rely on the standard function.
I opened https://gishub.org/geemap-colab and executed one cell after the other.
no crash here, the output just remains empty.
I were trying to get the geemap python package for interactive mapping. After, the run the command Map doesn't run.
m = geemap.Map()
m
HttpError Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
337 try:
--> 338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
~/anaconda3/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
~/anaconda3/lib/python3.7/site-packages/googleapiclient/http.py in execute(self, http, num_retries)
906 if resp.status >= 300:
--> 907 raise HttpError(resp, content, uri=self.uri)
908 return self.postproc(resp, content)
HttpError: <HttpError 403 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/algorithms?prettyPrint=false&alt=json returned "Permission denied.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/geemap/geemap.py in ee_initialize()
23 try:
---> 24 ee.Initialize()
25 except Exception as e:
~/anaconda3/lib/python3.7/site-packages/ee/init.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key, http_transport, project)
124 # Initialize the dynamically loaded functions on the objects that want them.
--> 125 ApiFunction.initialize()
126 Element.initialize()
~/anaconda3/lib/python3.7/site-packages/ee/apifunction.py in initialize(cls)
153 if not cls._api:
--> 154 signatures = data.getAlgorithms()
155 api = {}
~/anaconda3/lib/python3.7/site-packages/ee/data.py in getAlgorithms()
1042 project=_get_projects_path(), prettyPrint=False)
-> 1043 return _cloud_api_utils.convert_algorithms(execute_cloud_call(call))
1044 return send('/algorithms', {}, 'GET')
~/anaconda3/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
339 except googleapiclient.errors.HttpError as e:
--> 340 raise _translate_cloud_exception(e)
341
EEException: Permission denied.
During handling of the above exception, another exception occurred:
HttpError Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
337 try:
--> 338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
~/anaconda3/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
~/anaconda3/lib/python3.7/site-packages/googleapiclient/http.py in execute(self, http, num_retries)
906 if resp.status >= 300:
--> 907 raise HttpError(resp, content, uri=self.uri)
908 return self.postproc(resp, content)
HttpError: <HttpError 403 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/algorithms?prettyPrint=false&alt=json returned "Permission denied.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
in
----> 1 m = geemap.Map()
2 m
~/anaconda3/lib/python3.7/site-packages/geemap/geemap.py in init(self, **kwargs)
41
42 # Authenticates Earth Engine and initialize an Earth Engine session
---> 43 ee_initialize()
44
45 # Default map center location and zoom level
~/anaconda3/lib/python3.7/site-packages/geemap/geemap.py in ee_initialize()
25 except Exception as e:
26 ee.Authenticate()
---> 27 ee.Initialize()
28
29
~/anaconda3/lib/python3.7/site-packages/ee/init.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key, http_transport, project)
123 http_transport=http_transport)
124 # Initialize the dynamically loaded functions on the objects that want them.
--> 125 ApiFunction.initialize()
126 Element.initialize()
127 Image.initialize()
~/anaconda3/lib/python3.7/site-packages/ee/apifunction.py in initialize(cls)
152 """Initializes the list of signatures from the Earth Engine front-end."""
153 if not cls._api:
--> 154 signatures = data.getAlgorithms()
155 api = {}
156 for name, sig in signatures.items():
~/anaconda3/lib/python3.7/site-packages/ee/data.py in getAlgorithms()
1041 call = _cloud_api_resource.projects().algorithms().list(
1042 project=_get_projects_path(), prettyPrint=False)
-> 1043 return _cloud_api_utils.convert_algorithms(execute_cloud_call(call))
1044 return send('/algorithms', {}, 'GET')
1045
~/anaconda3/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
--> 340 raise _translate_cloud_exception(e)
341
342
EEException: Permission denied.
Adding support for downloading Earth Engine Image as GeoTIFF and Numpy array
I was trying to run this example from the video as it is. and I noticed that graph on the bottom right appears too small infact it is mere dot. While the use inspector toggle was working fine.
import ee
import geemap
Map = geemap.Map(center=(28.5934, 77.2223), zoom=4)
landsat7 = ee.Image('LE7_TOA_5YEAR/1999_2003') \
.select([0, 1, 2, 3, 4, 6])
landsat_vis = {
'bands': ['B4', 'B3', 'B2'],
'gamma': 1.4
}
Map.addLayer(landsat7, landsat_vis, "LE7_TOA_5YEAR/1999_2003")
Map.set_plot_options(plot_type='line')
Map
I also tried this
m = geemap.Map(center=(28.5934, 77.2223), zoom=4)
m.plot_demo()
m
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
I have followed the steps on the video 8 about conversion from earth engine to jupyter notebook after the conversion done I open the script but the notebook can't run I got this message: A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
This will allow users to use some non-Map() functions (e.g., add animated text to GIF, shp_to_ee) with Google Colab.
Create popup in addition / instead of the inspector and show for example the label instead of the value.
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
This will allow users to simply draw a rectangle on the map to create a Landsat annual time-series (1984-2019). The resulting ImageCollection can be used to create animations. A big thanks to Justin Braaten @jdbcode for sharing both the Python and JavaScript source code for his fantastic lt-gee-time-series-animator. I will adapt his Python code and implement in geemap.
When i run Map.add_landsat_ts_gif(...)
in 18_create_landsat_timelapse.ipynb
, getting the following output:
Generating URL...
'ImageCollection' object has no attribute 'getVideoThumbURL'
Adding animated text to GIF ...
The input gif file does not exist.
The input gif file does not exist.
Adding GIF to the map ...
The provided file does not exist.
I did not modified only code of 18_create_landsat_timelapse.ipynb
.
Simply copy and paste GEE Javascripts to Jupyter notebook to generate Python code.
Useful resources for a implementing a search control:
When calling Map.add_legend(legend_title = ...
the keyword is capitalized in the method call, however, the corresponding keywords in legends.py
are not. This means some legend entries can not be found.
Map.add_legend(legend_title = "OPERNICUS/Landcover/100m/Proba-V/Global")
fails because the entry is capitalized in the method but not in legends.py
Hi Quisheng, first of all, wonderful work done on the development of this plugin. Thanks a lot for the time and effort you've invested in this. I was trying to use the ee_to_numpy functionality on Colab for Sentinel 2 imagery. It repeatedly threw errors. The errors were due to the following reasons. It isn't anything intrinsically wrong with your code, but rather a warning which can be included in the documentation.
Describe what you were trying to get done.
I am trying using my watershed baoundry(.shp) ('users/gaowudao/hybas_lake_as_lev06_v1c') to get the image in the specific watershed.
Tell us what happened, what went wrong, and what you expected to happen.
The error"Number.multiply: Parameter 'left' is required" occured
Paste the command(s) you ran and the output.
import geemap
from ipyleaflet import *
from ipywidgets import *
from geemap.eelib import *
Map = geemap.Map(center=(120, 40), zoom=4)
Map.default_style = {'cursor': 'pointer'}
Map
Map.setOptions('ROADMAP')
HUC6 = ee.FeatureCollection('users/gaowudao/hybas_lake_as_lev06_v1c');
# Add HUC layer to the map
Map.setCenter(120.00, 47.01, 8);
Map.addLayer(ee.Image().paint(HUC6, 0, 1), {}, 'HUC-6 Watershed') # HUC10 for the entire U.S.
label = Label("Click on the map to select a watershed")
widget_control = WidgetControl(widget=label, position='bottomright')
Map.add_control(widget_control)
layer = None
def handle_interaction(**kwargs):
latlon = kwargs.get('coordinates')
if kwargs.get('type') == 'click':
Map.default_style = {'cursor': 'wait'}
xy = ee.Geometry.Point(latlon[::-1])
watershed = HUC6.filterBounds(xy)
huc6_id = watershed.first().get('basin').getInfo()
Map.layers = Map.layers[:3]
Map.addLayer(ee.Image().paint(watershed, 0, 2), {'palette': 'red'}, 'HUC ID: ' + huc6_id)
NAIP_images = findNAIP(watershed)
first_image = ee.Image(NAIP_images.toList(5).get(0))
Map.addLayer(first_image, {'bands': ['N', 'R', 'G']}, 'first image')
# count = NAIP_images.size().getInfo()
# for i in range(0, count):
# image = ee.Image(NAIP_images.toList(count).get(i))
# Map.addLayer(image, {'bands': ['N', 'R', 'G']}, str(i))
Map.default_style = {'cursor': 'pointer'}
Map.on_interaction(handle_interaction)
Map
If there was a crash, please include the traceback here.
---------------------------------------------------------------------------
HttpError Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
337 try:
--> 338 return call.execute(num_retries=num_retries)
339 except apiclient.errors.HttpError as e:
~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/http.py in execute(self, http, num_retries)
897 if resp.status >= 300:
--> 898 raise HttpError(resp, content, uri=self.uri)
899 return self.postproc(resp, content)
HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/maps?fields=name&alt=json returned "Number.multiply: Parameter 'left' is required.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
<ipython-input-12-c2f4a242aeb9> in handle_interaction(**kwargs)
34 NAIP_images = findNAIP(watershed)
35 first_image = ee.Image(NAIP_images.toList(5).get(0))
---> 36 Map.addLayer(first_image, {'bands': ['N', 'R', 'G']}, 'first image')
37 # count = NAIP_images.size().getInfo()
38 # for i in range(0, count):
~/opt/anaconda3/lib/python3.7/site-packages/geemap/geemap.py in add_ee_layer(self, ee_object, vis_params, name, shown, opacity)
409 image = ee_object.mosaic()
410
--> 411 map_id_dict = ee.Image(image).getMapId(vis_params)
412 tile_layer = ipyleaflet.TileLayer(
413 url=map_id_dict['tile_fetcher'].url_format,
~/opt/anaconda3/lib/python3.7/site-packages/ee/image.py in getMapId(self, vis_params)
129 vis_image, request = self._apply_visualization(vis_params)
130 request['image'] = vis_image
--> 131 response = data.getMapId(request)
132 response['image'] = self
133 return response
~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in getMapId(params)
589 parent=_get_projects_path(),
590 fields='name',
--> 591 body=request))
592 map_name = result['name']
593 url_format = '%s/%s/%s/tiles/{z}/{x}/{y}' % (
~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
338 return call.execute(num_retries=num_retries)
339 except apiclient.errors.HttpError as e:
--> 340 raise _translate_cloud_exception(e)
341
342
EEException: Number.multiply: Parameter 'left' is required.
Currently, whenever a Folium map is added, a basemap ("Google Satellite" by default) is added:
ee_basemaps['HYBRID'].add_to(self)
Correponding to the line 198 of the eefolium.py file.
Could this be done optionally with some parameter?
Map = emap.Map()
When i use geemap in Jupyterlab, the Map function can not output the map, instead of
Map(center=[40, -100], controls=(WidgetControl(options=['position'], widget=HBox(children=(ToggleButton(value=…
So, is there possible to let geemap support Jupyterlab development?
Codes 1:
import geemap
Map = geemap.Map(center=[40,-100], zoom=4)
Map
Output 1:
Map(center=[40, -100], controls=(WidgetControl(options=['position'], widget=HBox(children=(ToggleButton(value=…
Codes 2:
import geemap.eefolium as emap
Map = emap.Map(center=[40,-100], zoom=4)
Map
Output 2: Normal map.
Supporting ipyleaflet under Jupyterlab with geemap.
The 'us-states.shp' was added into geemap, then converted to ee object. But the export is failed, error info is: "Generating URL ...
An error occurred while downloading.
'str' object has no attribute 'select'"
Code:
states_shp = r"/JupyterSpace/Data/geemap-master/examples/data/us-states.shp"
states = geemap.shp_to_ee(states_shp)
Map.addLayer(states,{},"States")
geemap.ee_export_vector(states,filename='/JupyterSpace/Data/states.csv')
thank you for your sharing! I followed the instruction and it showed "Successfully saved authorization token" in jupyter notebook. However, it couldn't display the map. Do you have any suggestion?
I have closed the firewall. And my VPN is in global mode and works well.
paste###################################paste
Successfully saved authorization token.
---------------------------------------------------------------------------
TimeoutError Traceback (most recent call last)
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\geemap\geemap.py in ee_initialize()
24 try:
---> 25 ee.Initialize()
26 except Exception as e:
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\ee\__init__.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key, http_transport, project)
114 credentials = data.get_persistent_credentials()
--> 115 data.initialize(
116 credentials=credentials,
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\ee\data.py in initialize(credentials, api_base_url, tile_base_url, use_cloud_api, cloud_api_base_url, cloud_api_key, project, http_transport)
209
--> 210 _install_cloud_api_resource()
211
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\ee\data.py in _install_cloud_api_resource()
279 timeout = (_deadline_ms / 1000.0) or None
--> 280 _cloud_api_resource = _cloud_api_utils.build_cloud_resource(
281 _cloud_api_base_url,
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\ee\_cloud_api_utils.py in build_cloud_resource(api_base_url, api_key, credentials, timeout, headers_supplier, response_inspector, http_transport, raw)
141 alt_model = None
--> 142 resource = discovery.build(
143 'earthengine',
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\googleapiclient\_helpers.py in positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\googleapiclient\discovery.py in build(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options)
223 try:
--> 224 content = _retrieve_discovery_doc(
225 requested_url, discovery_http, cache_discovery, cache, developerKey
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\googleapiclient\discovery.py in _retrieve_discovery_doc(url, http, cache_discovery, cache, developerKey)
281
--> 282 resp, content = http.request(actual_url)
283
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google_auth_httplib2.py in request(self, uri, method, body, headers, **kwargs)
185
--> 186 self.credentials.before_request(
187 self._request, method, uri, request_headers)
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google\auth\credentials.py in before_request(self, request, method, url, headers)
123 if not self.valid:
--> 124 self.refresh(request)
125 self.apply(headers)
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google\oauth2\credentials.py in refresh(self, request)
176
--> 177 access_token, refresh_token, expiry, grant_response = _client.refresh_grant(
178 request,
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google\oauth2\_client.py in refresh_grant(request, token_uri, refresh_token, client_id, client_secret, scopes)
247
--> 248 response_data = _token_endpoint_request(request, token_uri, body)
249
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google\oauth2\_client.py in _token_endpoint_request(request, token_uri, body)
104 while True:
--> 105 response = request(method="POST", url=token_uri, headers=headers, body=body)
106 response_body = (
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google_auth_httplib2.py in __call__(self, url, method, body, headers, timeout, **kwargs)
114 _LOGGER.debug('Making request: %s %s', method, url)
--> 115 response, data = self.http.request(
116 url, method=method, body=body, headers=headers, **kwargs)
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in request(self, uri, method, body, headers, redirections, connection_type)
1981 else:
-> 1982 (response, content) = self._request(
1983 conn,
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in _request(self, conn, host, absolute_uri, request_uri, method, body, headers, redirections, cachekey)
1649
-> 1650 (response, content) = self._conn_request(
1651 conn, request_uri, method, body, headers
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in _conn_request(self, conn, request_uri, method, body, headers)
1556 if conn.sock is None:
-> 1557 conn.connect()
1558 conn.request(method, request_uri, body, headers)
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in connect(self)
1390 if not self.sock:
-> 1391 raise socket_err
1392
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in connect(self)
1323 sock.settimeout(self.timeout)
-> 1324 sock.connect((self.host, self.port))
1325
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
During handling of the above exception, another exception occurred:
TimeoutError Traceback (most recent call last)
<ipython-input-1-a950a1b8bb48> in <module>
1 import geemap
----> 2 m=geemap.Map()
3 m
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\geemap\geemap.py in __init__(self, **kwargs)
42
43 # Authenticates Earth Engine and initializes an Earth Engine session
---> 44 ee_initialize()
45
46 # Default map center location and zoom level
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\geemap\geemap.py in ee_initialize()
26 except Exception as e:
27 ee.Authenticate()
---> 28 ee.Initialize()
29
30
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\ee\__init__.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key, http_transport, project)
113 if credentials == 'persistent':
114 credentials = data.get_persistent_credentials()
--> 115 data.initialize(
116 credentials=credentials,
117 api_base_url=(opt_url + '/api' if opt_url else None),
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\ee\data.py in initialize(credentials, api_base_url, tile_base_url, use_cloud_api, cloud_api_base_url, cloud_api_key, project, http_transport)
208 _http_transport = http_transport
209
--> 210 _install_cloud_api_resource()
211
212 if project is not None:
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\ee\data.py in _install_cloud_api_resource()
278
279 timeout = (_deadline_ms / 1000.0) or None
--> 280 _cloud_api_resource = _cloud_api_utils.build_cloud_resource(
281 _cloud_api_base_url,
282 credentials=_credentials,
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\ee\_cloud_api_utils.py in build_cloud_resource(api_base_url, api_key, credentials, timeout, headers_supplier, response_inspector, http_transport, raw)
140 else:
141 alt_model = None
--> 142 resource = discovery.build(
143 'earthengine',
144 VERSION,
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\googleapiclient\_helpers.py in positional_wrapper(*args, **kwargs)
132 elif positional_parameters_enforcement == POSITIONAL_WARNING:
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
136 return positional_wrapper
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\googleapiclient\discovery.py in build(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options)
222
223 try:
--> 224 content = _retrieve_discovery_doc(
225 requested_url, discovery_http, cache_discovery, cache, developerKey
226 )
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\googleapiclient\discovery.py in _retrieve_discovery_doc(url, http, cache_discovery, cache, developerKey)
280 logger.info("URL being requested: GET %s", actual_url)
281
--> 282 resp, content = http.request(actual_url)
283
284 if resp.status >= 400:
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google_auth_httplib2.py in request(self, uri, method, body, headers, **kwargs)
184 request_headers = headers.copy() if headers is not None else {}
185
--> 186 self.credentials.before_request(
187 self._request, method, uri, request_headers)
188
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google\auth\credentials.py in before_request(self, request, method, url, headers)
122 # the http request.)
123 if not self.valid:
--> 124 self.refresh(request)
125 self.apply(headers)
126
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google\oauth2\credentials.py in refresh(self, request)
175 )
176
--> 177 access_token, refresh_token, expiry, grant_response = _client.refresh_grant(
178 request,
179 self._token_uri,
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google\oauth2\_client.py in refresh_grant(request, token_uri, refresh_token, client_id, client_secret, scopes)
246 body["scope"] = " ".join(scopes)
247
--> 248 response_data = _token_endpoint_request(request, token_uri, body)
249
250 try:
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google\oauth2\_client.py in _token_endpoint_request(request, token_uri, body)
103 # occurs.
104 while True:
--> 105 response = request(method="POST", url=token_uri, headers=headers, body=body)
106 response_body = (
107 response.data.decode("utf-8")
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\google_auth_httplib2.py in __call__(self, url, method, body, headers, timeout, **kwargs)
113 try:
114 _LOGGER.debug('Making request: %s %s', method, url)
--> 115 response, data = self.http.request(
116 url, method=method, body=body, headers=headers, **kwargs)
117 return _Response(response, data)
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in request(self, uri, method, body, headers, redirections, connection_type)
1980 content = b""
1981 else:
-> 1982 (response, content) = self._request(
1983 conn,
1984 authority,
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in _request(self, conn, host, absolute_uri, request_uri, method, body, headers, redirections, cachekey)
1648 auth.request(method, request_uri, headers, body)
1649
-> 1650 (response, content) = self._conn_request(
1651 conn, request_uri, method, body, headers
1652 )
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in _conn_request(self, conn, request_uri, method, body, headers)
1555 try:
1556 if conn.sock is None:
-> 1557 conn.connect()
1558 conn.request(method, request_uri, body, headers)
1559 except socket.timeout:
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in connect(self)
1389 break
1390 if not self.sock:
-> 1391 raise socket_err
1392
1393
D:\Users\zwx\miniconda3\envs\gee\lib\site-packages\httplib2\__init__.py in connect(self)
1322 if has_timeout(self.timeout):
1323 sock.settimeout(self.timeout)
-> 1324 sock.connect((self.host, self.port))
1325
1326 self.sock = self._context.wrap_socket(sock, server_hostname=self.host)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
Describe what you were trying to get done.
I want to export two images to local computer by using geemap.ee_export_image() function
Tell us what happened, what went wrong, and what you expected to happen.
but can not export large files.
geemap.ee_export_image(image, filename=filename, scale=30, region=roi, file_per_band=False)
If there was a crash, please include the traceback here.
An error occurred while downloading.
Pixel grid dimensions (12958x8118) must be less than or equal to 10000.
An error occurred while downloading.
Total request size (81829440 bytes) must be less than or equal to 33554432 bytes.
Hi~ I know how to create a colorbar and add it to a GIF. But I'm confused about how to add a colorbar to the Map. I searched a lot and cannot find solutions. Could you give me some suggestions? Thanks very much.
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
It would nice to be able to add a legend of an Earth Engine thematic data layer (e.g., classified image) to the map.
I was trying to display the precipitationCal
band of the NASA/GPM_L3/IMERG_V06
dataset. I'd like to plot the time series of the precipitation for a location, but it shows the (mean?) precipitation as a function of the band.
import ee
import geemap
Map = geemap.Map()
Map
gpm = ee.ImageCollection('NASA/GPM_L3/IMERG_V06') \
.filter(ee.Filter.date('2016-01-01', '2016-02-01'));
#.select('precipitationCal');
options = {
'bands': ['precipitationCal'],
'opacity': 0.5,
'min': 0,
'max': 15,
'palette': ['000096','0064ff', '00b4ff', '33db80', '9beb4a', 'ffeb00', 'ffb300', 'ff6400', 'eb1e00', 'af0000']
}
Map.addLayer(gpm, options, 'GPM');
Have you considered moving from https://github.com/DenisCarriere/geocoder to https://pypi.org/project/geopy which seems to provide a much vaster list of services? I admit I'm not too familiar with https://github.com/DenisCarriere/geocoder, but it seems to be not that actively maintained in comparison, and I wrote the HERE plugin for geopy which e.g. also gives you polygons in some cases. And I saw the stellar support from the maintainer of the package and its very nice architecture. Just an idea...
I am betting this is rather an ipyleaflet plus jupyter-lab issue, but I open this ticket hoping to provide workarounds/fixes for other users as this may be one of the first experience (i.e. impression) for newcomers.
example notebook 01_geemap_intro
Map
does not display in the cell output in jupyterlab, instead "Loading widget..." or "Error displaying widget: model not found"
Display works if accessed/run from jupyter-notebook however. I think I previously similar symptoms with upyleaflet
Updated an existing conda env which had ipyleaflet working. conda update -c conda-forge python=3.8
, then conda install -c conda-forge geemap
jupyter-lab opened and requested a rebuild of the extensions:
[W 12:30:43.793 LabApp] Build recommended
[W 12:30:43.793 LabApp] jupyter-leaflet needs to be included in build
[W 12:30:43.793 LabApp] @jupyter-widgets/jupyterlab-manager needs to be included in build
Once done, Map
resulted in "Loading widget..." , but I think this was because I should have restarted jupyter-lab. Using the script
#!/bin/bash
source ${HOME}/anaconda3/bin/activate sv
jupyter-nbextension list
cd ${HOME}/src/github/geemap
jupyter-lab --browser=/usr/bin/google-chrome
Known nbextensions:
config dir: /home/xxxyyy/anaconda3/envs/sv/etc/jupyter/nbconfig
notebook section
bqplot/extension enabled
- Validating: OK
jupyter-leaflet/extension enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
config dir: /etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
but upon re-execution of the notebook 01_geemap_intro Map
then leads to "Error displaying widget: model not found"
I am trying to convert a shapefile to ee object to display on map. The shapefile imports successfully using GEE Code Editor, but when adding it to a map in Jupyter Lab, I get 'EEException: Request payload size exceeds the limit: 4194304 bytes.'
import geemap
import ee
#geemap.update_package()
Map = geemap.Map()
Map
#add CB shapefile
CB_shp = '/home/silsbelab/Downloads/CB.shp'
CB = geemap.shp_to_ee(CB_shp) #converts shp to ee object
Map.addLayer(CB)
---------------------------------------------------------------------------
HttpError Traceback (most recent call last)
~/anaconda2/envs/gee/lib/python3.8/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
337 try:
--> 338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
~/anaconda2/envs/gee/lib/python3.8/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
~/anaconda2/envs/gee/lib/python3.8/site-packages/googleapiclient/http.py in execute(self, http, num_retries)
906 if resp.status >= 300:
--> 907 raise HttpError(resp, content, uri=self.uri)
908 return self.postproc(resp, content)
HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/maps?fields=name&alt=json returned "Request payload size exceeds the limit: 4194304 bytes.">
During handling of the above exception, another exception occurred:
EEException Traceback (most recent call last)
<ipython-input-4-0302c7a9e3c9> in <module>
----> 1 Map.addLayer(CB)
~/anaconda2/envs/gee/lib/python3.8/site-packages/geemap/geemap.py in add_ee_layer(self, ee_object, vis_params, name, shown, opacity)
772 image = ee_object.mosaic()
773
--> 774 map_id_dict = ee.Image(image).getMapId(vis_params)
775 tile_layer = ipyleaflet.TileLayer(
776 url=map_id_dict['tile_fetcher'].url_format,
~/anaconda2/envs/gee/lib/python3.8/site-packages/ee/image.py in getMapId(self, vis_params)
129 vis_image, request = self._apply_visualization(vis_params)
130 request['image'] = vis_image
--> 131 response = data.getMapId(request)
132 response['image'] = self
133 return response
~/anaconda2/envs/gee/lib/python3.8/site-packages/ee/data.py in getMapId(params)
586 # Make it return only the name field, as otherwise it echoes the entire
587 # request, which might be large.
--> 588 result = _execute_cloud_call(_cloud_api_resource.projects().maps().create(
589 parent=_get_projects_path(),
590 fields='name',
~/anaconda2/envs/gee/lib/python3.8/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
338 return call.execute(num_retries=num_retries)
339 except googleapiclient.errors.HttpError as e:
--> 340 raise _translate_cloud_exception(e)
341
342
EEException: Request payload size exceeds the limit: 4194304 bytes.
When I use the zonal_statistics function, I found that the scale parameter is described as: scale = in_value_raster.projection().nominalScale().multiply(10). Why the nominalScale need multiply 10? If we do not multiply 10,
When I use the zonal_statistics function, I find that the scale parameter is described as:
scale = in_value_raster.projection().nominalScale().multiply(10)
Why does the nominalScale need to be multiplied by 10? If we do not multiply by 10 (directly set the scale as its nominalScale), is the result the same as multiplying by 10? How about multiplying by 20?
To create an ipyleaflet-based interactive map:
import geemap
Map = geemap.Map(center=[40,-100], zoom=4)
Map
The authorization workflow will generate a code, which you should paste in the box below
Enter verification code: 4/ygHh6q9jZKNxNFZGzqyBdZ_hDzh2RWWUdByY16Q6Jv2eXm5eCTTnTV4
Successfully saved authorization token.
TimeoutError Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
156 conn = connection.create_connection(
--> 157 (self._dns_host, self.port), self.timeout, **extra_kw
158 )
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
83 if err is not None:
---> 84 raise err
85
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
73 sock.bind(source_address)
---> 74 sock.connect(sa)
75 return sock
TimeoutError: [Errno 60] Operation timed out
During handling of the above exception, another exception occurred:
NewConnectionError Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/httplib2shim/init.py in _conn_request(self, conn, request_uri, method, body, headers)
147 timeout=urllib3.Timeout(total=self.timeout),
--> 148 decode_content=decode)
149
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/request.py in request(self, method, url, fields, headers, **urlopen_kw)
79 return self.request_encode_body(
---> 80 method, url, fields=fields, headers=headers, **urlopen_kw
81 )
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/request.py in request_encode_body(self, method, url, fields, headers, encode_multipart, multipart_boundary, **urlopen_kw)
170
--> 171 return self.urlopen(method, url, **extra_kw)
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/poolmanager.py in urlopen(self, method, url, redirect, **kw)
329 else:
--> 330 response = conn.urlopen(method, u.request_uri, **kw)
331
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
719 retries = retries.increment(
--> 720 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
721 )
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
375 # Disabled, indicate to re-raise the error.
--> 376 raise six.reraise(type(error), error, _stacktrace)
377
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/packages/six.py in reraise(tp, value, tb)
734 raise value.with_traceback(tb)
--> 735 raise value
736 finally:
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
671 headers=headers,
--> 672 chunked=chunked,
673 )
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
375 try:
--> 376 self._validate_conn(conn)
377 except (SocketTimeout, BaseSSLError) as e:
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in _validate_conn(self, conn)
993 if not getattr(conn, "sock", None): # AppEngine might not have .sock
--> 994 conn.connect()
995
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in connect(self)
299 # Add certificate verification
--> 300 conn = self._new_conn()
301 hostname = self.host
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
168 raise NewConnectionError(
--> 169 self, "Failed to establish a new connection: %s" % e
170 )
NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x11bf026d0>: Failed to establish a new connection: [Errno 60] Operation timed out
During handling of the above exception, another exception occurred:
timeout Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/geemap/geemap.py in ee_initialize()
19 try:
---> 20 ee.Initialize()
21 except Exception as e:
~/opt/anaconda3/lib/python3.7/site-packages/ee/init.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key, http_transport, project)
122 project=project,
--> 123 http_transport=http_transport)
124 # Initialize the dynamically loaded functions on the objects that want them.
~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in initialize(credentials, api_base_url, tile_base_url, use_cloud_api, cloud_api_base_url, cloud_api_key, project, http_transport)
209
--> 210 _install_cloud_api_resource()
211
~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in _install_cloud_api_resource()
286 response_inspector=_handle_profiling_response,
--> 287 http_transport=_http_transport)
288
~/opt/anaconda3/lib/python3.7/site-packages/ee/_cloud_api_utils.py in build_cloud_resource(api_base_url, api_key, credentials, timeout, headers_supplier, response_inspector, http_transport, raw)
148 requestBuilder=request_builder,
--> 149 model=alt_model)
150 return resource
~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/discovery.py in build(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options)
224 content = _retrieve_discovery_doc(
--> 225 requested_url, discovery_http, cache_discovery, cache, developerKey
226 )
~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/discovery.py in _retrieve_discovery_doc(url, http, cache_discovery, cache, developerKey)
281
--> 282 resp, content = http.request(actual_url)
283
~/opt/anaconda3/lib/python3.7/site-packages/google_auth_httplib2.py in request(self, uri, method, body, headers, **kwargs)
186 self.credentials.before_request(
--> 187 self._request, method, uri, request_headers)
188
~/opt/anaconda3/lib/python3.7/site-packages/google/auth/credentials.py in before_request(self, request, method, url, headers)
123 if not self.valid:
--> 124 self.refresh(request)
125 self.apply(headers)
~/opt/anaconda3/lib/python3.7/site-packages/google/oauth2/credentials.py in refresh(self, request)
182 self._client_secret,
--> 183 self._scopes,
184 )
~/opt/anaconda3/lib/python3.7/site-packages/google/oauth2/_client.py in refresh_grant(request, token_uri, refresh_token, client_id, client_secret, scopes)
247
--> 248 response_data = _token_endpoint_request(request, token_uri, body)
249
~/opt/anaconda3/lib/python3.7/site-packages/google/oauth2/_client.py in _token_endpoint_request(request, token_uri, body)
104 while True:
--> 105 response = request(method="POST", url=token_uri, headers=headers, body=body)
106 response_body = (
~/opt/anaconda3/lib/python3.7/site-packages/google_auth_httplib2.py in call(self, url, method, body, headers, timeout, **kwargs)
115 response, data = self.http.request(
--> 116 url, method=method, body=body, headers=headers, **kwargs)
117 return _Response(response, data)
~/opt/anaconda3/lib/python3.7/site-packages/httplib2/init.py in request(self, uri, method, body, headers, redirections, connection_type)
1990 redirections,
-> 1991 cachekey,
1992 )
~/opt/anaconda3/lib/python3.7/site-packages/httplib2/init.py in _request(self, conn, host, absolute_uri, request_uri, method, body, headers, redirections, cachekey)
1650 (response, content) = self._conn_request(
-> 1651 conn, request_uri, method, body, headers
1652 )
~/opt/anaconda3/lib/python3.7/site-packages/httplib2shim/init.py in _conn_request(self, conn, request_uri, method, body, headers)
153 except Exception as e:
--> 154 raise _map_exception(e)
155
timeout: timed out
During handling of the above exception, another exception occurred:
TimeoutError Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
156 conn = connection.create_connection(
--> 157 (self._dns_host, self.port), self.timeout, **extra_kw
158 )
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
83 if err is not None:
---> 84 raise err
85
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
73 sock.bind(source_address)
---> 74 sock.connect(sa)
75 return sock
TimeoutError: [Errno 60] Operation timed out
During handling of the above exception, another exception occurred:
NewConnectionError Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/httplib2shim/init.py in _conn_request(self, conn, request_uri, method, body, headers)
147 timeout=urllib3.Timeout(total=self.timeout),
--> 148 decode_content=decode)
149
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/request.py in request(self, method, url, fields, headers, **urlopen_kw)
79 return self.request_encode_body(
---> 80 method, url, fields=fields, headers=headers, **urlopen_kw
81 )
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/request.py in request_encode_body(self, method, url, fields, headers, encode_multipart, multipart_boundary, **urlopen_kw)
170
--> 171 return self.urlopen(method, url, **extra_kw)
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/poolmanager.py in urlopen(self, method, url, redirect, **kw)
329 else:
--> 330 response = conn.urlopen(method, u.request_uri, **kw)
331
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
719 retries = retries.increment(
--> 720 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
721 )
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
375 # Disabled, indicate to re-raise the error.
--> 376 raise six.reraise(type(error), error, _stacktrace)
377
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/packages/six.py in reraise(tp, value, tb)
734 raise value.with_traceback(tb)
--> 735 raise value
736 finally:
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
671 headers=headers,
--> 672 chunked=chunked,
673 )
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
375 try:
--> 376 self._validate_conn(conn)
377 except (SocketTimeout, BaseSSLError) as e:
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py in _validate_conn(self, conn)
993 if not getattr(conn, "sock", None): # AppEngine might not have .sock
--> 994 conn.connect()
995
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in connect(self)
299 # Add certificate verification
--> 300 conn = self._new_conn()
301 hostname = self.host
~/opt/anaconda3/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self)
168 raise NewConnectionError(
--> 169 self, "Failed to establish a new connection: %s" % e
170 )
NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x108bb05d0>: Failed to establish a new connection: [Errno 60] Operation timed out
During handling of the above exception, another exception occurred:
timeout Traceback (most recent call last)
in
----> 1 Map = geemap.Map(center=[40,-100], zoom=4)
2 Map
~/opt/anaconda3/lib/python3.7/site-packages/geemap/geemap.py in init(self, **kwargs)
37
38 # Authenticates Earth Engine and initialize an Earth Engine session
---> 39 ee_initialize()
40
41 # Default map center location and zoom level
~/opt/anaconda3/lib/python3.7/site-packages/geemap/geemap.py in ee_initialize()
21 except Exception as e:
22 ee.Authenticate()
---> 23 ee.Initialize()
24
25
~/opt/anaconda3/lib/python3.7/site-packages/ee/init.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key, http_transport, project)
121 cloud_api_key=cloud_api_key,
122 project=project,
--> 123 http_transport=http_transport)
124 # Initialize the dynamically loaded functions on the objects that want them.
125 ApiFunction.initialize()
~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in initialize(credentials, api_base_url, tile_base_url, use_cloud_api, cloud_api_base_url, cloud_api_key, project, http_transport)
208 _http_transport = http_transport
209
--> 210 _install_cloud_api_resource()
211
212 if project is not None:
~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in _install_cloud_api_resource()
285 headers_supplier=_make_request_headers,
286 response_inspector=_handle_profiling_response,
--> 287 http_transport=_http_transport)
288
289 _cloud_api_resource_raw = _cloud_api_utils.build_cloud_resource(
~/opt/anaconda3/lib/python3.7/site-packages/ee/_cloud_api_utils.py in build_cloud_resource(api_base_url, api_key, credentials, timeout, headers_supplier, response_inspector, http_transport, raw)
147 http=http_transport,
148 requestBuilder=request_builder,
--> 149 model=alt_model)
150 return resource
151
~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
132 elif positional_parameters_enforcement == POSITIONAL_WARNING:
133 logger.warning(message)
--> 134 return wrapped(*args, **kwargs)
135
136 return positional_wrapper
~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/discovery.py in build(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options)
223 try:
224 content = _retrieve_discovery_doc(
--> 225 requested_url, discovery_http, cache_discovery, cache, developerKey
226 )
227 return build_from_document(
~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/discovery.py in _retrieve_discovery_doc(url, http, cache_discovery, cache, developerKey)
280 logger.info("URL being requested: GET %s", actual_url)
281
--> 282 resp, content = http.request(actual_url)
283
284 if resp.status >= 400:
~/opt/anaconda3/lib/python3.7/site-packages/google_auth_httplib2.py in request(self, uri, method, body, headers, **kwargs)
185
186 self.credentials.before_request(
--> 187 self._request, method, uri, request_headers)
188
189 # Check if the body is a file-like stream, and if so, save the body
~/opt/anaconda3/lib/python3.7/site-packages/google/auth/credentials.py in before_request(self, request, method, url, headers)
122 # the http request.)
123 if not self.valid:
--> 124 self.refresh(request)
125 self.apply(headers)
126
~/opt/anaconda3/lib/python3.7/site-packages/google/oauth2/credentials.py in refresh(self, request)
181 self._client_id,
182 self._client_secret,
--> 183 self._scopes,
184 )
185
~/opt/anaconda3/lib/python3.7/site-packages/google/oauth2/_client.py in refresh_grant(request, token_uri, refresh_token, client_id, client_secret, scopes)
246 body["scope"] = " ".join(scopes)
247
--> 248 response_data = _token_endpoint_request(request, token_uri, body)
249
250 try:
~/opt/anaconda3/lib/python3.7/site-packages/google/oauth2/_client.py in _token_endpoint_request(request, token_uri, body)
103 # occurs.
104 while True:
--> 105 response = request(method="POST", url=token_uri, headers=headers, body=body)
106 response_body = (
107 response.data.decode("utf-8")
~/opt/anaconda3/lib/python3.7/site-packages/google_auth_httplib2.py in call(self, url, method, body, headers, timeout, **kwargs)
114 _LOGGER.debug('Making request: %s %s', method, url)
115 response, data = self.http.request(
--> 116 url, method=method, body=body, headers=headers, **kwargs)
117 return _Response(response, data)
118 except httplib2.HttpLib2Error as exc:
~/opt/anaconda3/lib/python3.7/site-packages/httplib2/init.py in request(self, uri, method, body, headers, redirections, connection_type)
1989 headers,
1990 redirections,
-> 1991 cachekey,
1992 )
1993 except Exception as e:
~/opt/anaconda3/lib/python3.7/site-packages/httplib2/init.py in _request(self, conn, host, absolute_uri, request_uri, method, body, headers, redirections, cachekey)
1649
1650 (response, content) = self._conn_request(
-> 1651 conn, request_uri, method, body, headers
1652 )
1653
~/opt/anaconda3/lib/python3.7/site-packages/httplib2shim/init.py in _conn_request(self, conn, request_uri, method, body, headers)
152
153 except Exception as e:
--> 154 raise _map_exception(e)
155
156 return response, content
timeout: timed out
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.