Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after layer is added #195

Closed
zacdezgeo opened this issue Jan 16, 2025 · 0 comments · Fixed by #190
Closed

Error after layer is added #195

zacdezgeo opened this issue Jan 16, 2025 · 0 comments · Fixed by #190
Labels

Comments

@zacdezgeo
Copy link
Collaborator

zacdezgeo commented Jan 16, 2025

I ran the provided basic_geometries.py example script from the examples folder, which sequentially adds multiple geometries to the map. However, I found that the code was exiting after the first geometry was added. When adding a single geometry we get the following error:

Code to reproduce:

import ee

from ee_plugin import Map

point = ee.Geometry.Point([1.5, 1.5])
Map.addLayer(point, {"color": "1eff05"}, "point")

Error:

Traceback (most recent call last):
  File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "<string>", line 6, in <module>
  File "/Users/zacdez/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/ee_plugin/Map.py", line 32, in addLayer
    utils.add_or_update_ee_layer(eeObject, visParams, name, shown, opacity)
  File "/Users/zacdez/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/ee_plugin/utils.py", line 172, in add_or_update_ee_layer
    update_ee_layer_properties(layer, eeObject, visParams, shown, opacity)
  File "/Users/zacdez/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/ee_plugin/utils.py", line 29, in update_ee_layer_properties
    layer.dataProvider().set_ee_object(eeObject)
AttributeError: 'QgsRasterDataProvider' object has no attribute 'set_ee_object'

I erroneously thought the issue was sequentially adding geometries, but the code is just exiting after adding the first layer. It's problematic because users who want to do any subsequent operations in their script cannot do so; the code will exit.

@zacdezgeo zacdezgeo added the bug label Jan 16, 2025
@zacdezgeo zacdezgeo changed the title Error adding multiple geometries sequentially Error after layer is added Jan 16, 2025
This was referenced Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant