Skip to content

Commit

Permalink
Attempt to add test on identify using a raster
Browse files Browse the repository at this point in the history
Test fails because of projection issue with ee.Reducer.
  • Loading branch information
zacdezgeo committed Jan 17, 2025
1 parent ebe1058 commit 58d71a7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,30 @@ def test_point_identify():
geometry = result[0].geometry()
assert geometry is not None, "Geometry of identified feature is None"
assert not geometry.asPoint().isNull(), "Identified point is invalid (0, 0)"


def test_raster_identify():
image = ee.Image("USGS/SRTMGL1_003")
vis_params = {
"min": 0,
"max": 4000,
"palette": ["006633", "E5FFCC", "662A00", "D8D8D8", "F5F5F5"],
}
Map.addLayer(image, vis_params, "DEM")

layer = QgsProject.instance().mapLayersByName("DEM")[0]
assert layer is not None, "Layer 'DEM' was not added to the project"

provider = layer.dataProvider()
assert provider is not None, "Provider for the layer could not be retrieved"

point = QgsPointXY(
-13553481.96255343593657017, 5907008.49828365817666054
) # Example point in WGS84

result = provider.identify(
point, format=None, boundingBox=None, width=None, height=None
)
print("Identify result:", result.results())
assert result, "Identify operation returned no results"
assert len(result.results()) > 0, "Identify operation returned an empty result set"

0 comments on commit 58d71a7

Please sign in to comment.