gee-community / qgis-earthengine-plugin

Integrates Google Earth Engine and QGIS using Python API
http://qgis-ee-plugin.appspot.com
MIT License
454 stars 116 forks source link

Map.addLayer() resulting in KeyError: 'ee_plugin' #49

Closed spacefan closed 4 years ago

spacefan commented 4 years ago

1. Problem description When i run the fellow code, everything is OK:

# -*- coding:utf-8 -*-
import ee
from ee_plugin import Map

image = ee.Image('USGS/SRTMGL1_003').unitScale(0, 5000)

but KeyError: 'ee_plugin' error occured after execlute Map.addLayer():

Map.addLayer(image, {'palette': ['blue', 'red'], 'min': 0, 'max': 1000}, 'dem', True)

KeyError: 'ee_plugin' error

2. Enviorment

OS: Win 10 x64 QGIS: 3.10.1 Python: 3.7.0

gena commented 4 years ago

This looks like something is wrong with the QGIS plugins dictionary. Can you check if the plugin is enabled in the Plugins > Manage and Install Plugins ...? Does this occur every time?

spacefan commented 4 years ago

When i restart QGIS, QGIS throw an exception:

Couldn't load plugin 'ee_plugin' due to an error when calling its classFactory() method 

but Google Earth Engine is enabled, and the fellow code can be execluted without error in Python console:

# -*- coding:utf-8 -*-
import ee
from ee_plugin import Map

image = ee.Image('USGS/SRTMGL1_003').unitScale(0, 5000)
spacefan commented 4 years ago

Problem solved, thanks for your kind replay! @gena

xtnncherish315 commented 4 years ago

Problem solved, thanks for your kind replay! @gena

had the same problem.how you fix it?