diff --git a/workflow.html b/workflow.html
index b5f2e86..869ab54 100644
--- a/workflow.html
+++ b/workflow.html
@@ -66,7 +66,8 @@
Module geoengine.workflow
from geoengine.error import GeoEngineException, InputException, MethodNotCalledOnPlotException, \
MethodNotCalledOnRasterException, MethodNotCalledOnVectorException
from geoengine import backports
-from geoengine.types import ProvenanceEntry, QueryRectangle, ResultDescriptor
+from geoengine.types import ProvenanceEntry, QueryRectangle, ResultDescriptor, VectorResultDescriptor, \
+ ClassificationMeasurement
from geoengine.tasks import Task, TaskId
from geoengine.workflow_builder.operators import Operator as WorkflowBuilderOperator
from geoengine.raster import RasterTile2D
@@ -217,7 +218,12 @@ Module geoengine.workflow
return response
- def get_dataframe(self, bbox: QueryRectangle, timeout: int = 3600) -> gpd.GeoDataFrame:
+ def get_dataframe(
+ self,
+ bbox: QueryRectangle,
+ timeout: int = 3600,
+ resolve_classifications: bool = False
+ ) -> gpd.GeoDataFrame:
'''
Query a workflow and return the WFS result as a GeoPandas `GeoDataFrame`
'''
@@ -264,7 +270,22 @@ Module geoengine.workflow
return data
- return geo_json_with_time_to_geopandas(response.to_dict())
+ def transform_classifications(data: gpd.GeoDataFrame):
+ result_descriptor: VectorResultDescriptor = self.__result_descriptor # type: ignore
+ for (column, info) in result_descriptor.columns.items():
+ if isinstance(info.measurement, ClassificationMeasurement):
+ measurement: ClassificationMeasurement = info.measurement
+ classes = measurement.classes
+ data[column] = data[column].apply(lambda x: classes[x]) # pylint: disable=cell-var-from-loop
+
+ return data
+
+ result = geo_json_with_time_to_geopandas(response.to_dict())
+
+ if resolve_classifications:
+ result = transform_classifications(result)
+
+ return result
def wms_get_map_as_image(self, bbox: QueryRectangle, colorizer: Colorizer) -> Image:
'''Return the result of a WMS request as a PIL Image'''
@@ -1518,7 +1539,12 @@ Class variables
return response
- def get_dataframe(self, bbox: QueryRectangle, timeout: int = 3600) -> gpd.GeoDataFrame:
+ def get_dataframe(
+ self,
+ bbox: QueryRectangle,
+ timeout: int = 3600,
+ resolve_classifications: bool = False
+ ) -> gpd.GeoDataFrame:
'''
Query a workflow and return the WFS result as a GeoPandas `GeoDataFrame`
'''
@@ -1565,7 +1591,22 @@ Class variables
return data
- return geo_json_with_time_to_geopandas(response.to_dict())
+ def transform_classifications(data: gpd.GeoDataFrame):
+ result_descriptor: VectorResultDescriptor = self.__result_descriptor # type: ignore
+ for (column, info) in result_descriptor.columns.items():
+ if isinstance(info.measurement, ClassificationMeasurement):
+ measurement: ClassificationMeasurement = info.measurement
+ classes = measurement.classes
+ data[column] = data[column].apply(lambda x: classes[x]) # pylint: disable=cell-var-from-loop
+
+ return data
+
+ result = geo_json_with_time_to_geopandas(response.to_dict())
+
+ if resolve_classifications:
+ result = transform_classifications(result)
+
+ return result
def wms_get_map_as_image(self, bbox: QueryRectangle, colorizer: Colorizer) -> Image:
'''Return the result of a WMS request as a PIL Image'''
@@ -2302,7 +2343,7 @@ Parameters
-def get_dataframe(self, bbox: QueryRectangle, timeout: int = 3600) ‑> geopandas.geodataframe.GeoDataFrame
+def get_dataframe(self, bbox: QueryRectangle, timeout: int = 3600, resolve_classifications: bool = False) ‑> geopandas.geodataframe.GeoDataFrame
Query a workflow and return the WFS result as a GeoPandas GeoDataFrame
@@ -2310,7 +2351,12 @@ Parameters
Expand source code
-def get_dataframe(self, bbox: QueryRectangle, timeout: int = 3600) -> gpd.GeoDataFrame:
+def get_dataframe(
+ self,
+ bbox: QueryRectangle,
+ timeout: int = 3600,
+ resolve_classifications: bool = False
+) -> gpd.GeoDataFrame:
'''
Query a workflow and return the WFS result as a GeoPandas `GeoDataFrame`
'''
@@ -2357,7 +2403,22 @@ Parameters
return data
- return geo_json_with_time_to_geopandas(response.to_dict())
+ def transform_classifications(data: gpd.GeoDataFrame):
+ result_descriptor: VectorResultDescriptor = self.__result_descriptor # type: ignore
+ for (column, info) in result_descriptor.columns.items():
+ if isinstance(info.measurement, ClassificationMeasurement):
+ measurement: ClassificationMeasurement = info.measurement
+ classes = measurement.classes
+ data[column] = data[column].apply(lambda x: classes[x]) # pylint: disable=cell-var-from-loop
+
+ return data
+
+ result = geo_json_with_time_to_geopandas(response.to_dict())
+
+ if resolve_classifications:
+ result = transform_classifications(result)
+
+ return result