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

Bug 195/add vector layer #196

Merged
merged 4 commits into from
Jan 17, 2025
Merged

Conversation

zacdezgeo
Copy link
Collaborator

What I Changed

  • Moved fixtures to contest so we can reuse with multiple tests files
  • Define tests on vector geometries
  • Fix bug by defining the provider used upon layer creation

How to test it

  • Run the test suite: python3 -m pytest test
  • Checkout our CI

Other notes

@zacdezgeo zacdezgeo requested review from gena and alukach January 17, 2025 00:08
@zacdezgeo zacdezgeo self-assigned this Jan 17, 2025
@zacdezgeo zacdezgeo merged commit 82e9315 into test/base-example Jan 17, 2025
1 check passed
@zacdezgeo zacdezgeo deleted the bug-195/add-vector-layer branch January 17, 2025 16:52
@zacdezgeo zacdezgeo mentioned this pull request Jan 17, 2025
# TODO
layer = QgsRasterLayer(url, name, "wms")

layer = QgsRasterLayer(url, name, "EE")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting for future 👀: So the practical impact here is that we are treating all Earth Engine data as a QgsRasterLayer layer registered with the "EE" provider which is managed via our custom EarthEngineRasterDataProvider.

class EarthEngineRasterDataProvider(QgsRasterDataProvider):
PARENT = QObject()
# def __getattribute__(self, attr):
# method = object.__getattribute__(self, attr)
# # if not method:
# # raise Exception("Method %s not implemented" % attr)
# if callable(method):
# print(f"method: {attr}")
# return method
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.ee_object = None
self._args = args
self._kwargs = kwargs
# create WMS provider
self.wms = QgsProviderRegistry.instance().createProvider("wms", *args, **kwargs)
@classmethod
def description(cls):
return "Google Earth Engine Raster Data Provider"
@classmethod
def providerKey(cls):
return "EE"

zacdezgeo added a commit that referenced this pull request Jan 17, 2025
* Writing some initial tests for Map.py using pytest-qgis

* Add proper registration of WMS provider

* wip to test add_layers functionality

* Add python env file to use extlibs as pythonpath

* Debug adding provider

* Base example test implemented

* Update CI to authenticate to earthengine

* Add test to pythonpath

* Revert pytest call in CI

* Add pythonpath

* Simplify test execution in CI 

* Add future for CI dependencies

* Reorganized plugin code into a module

* Activate virtualenv to avoid system wide permissions error

* Update python version to 3.9

* Move plugin files to ee_plugin module

Clean up installed plugin to include only extlibs and python files.

* Modify path for paver package to avoid nested ee_plugin

* Add icons, i18n, and contrib to paver packaging

* Update path to ee_plugin module

* Add paver to dev requirements

* Bug 195/add vector layer (#196)

* Move fixtures to separate conftest.py file

The goal will be to reuse the fixture for other tests

* Add unit test reproducing the bud

* Fix bug adding vector layers by creating layers with the EE flag

* Simplify code paths layer is a QgsRasterLayer in any case

---------

Co-authored-by: Anthony Lukach <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants