qgis / qwc2-demo-app

QWC2 demo application
Other
240 stars 154 forks source link

TimeManager: Unsupported geometry type 'MULTIPOINTZ' #575

Open rsrg-zwiama opened 2 weeks ago

rsrg-zwiama commented 2 weeks ago

The FeatureInfo Service fails with Geometries defined with ..._Z values in PosGIS, when the TimeManager uses the featureInfoService.

The package geomet wkt can not handle the Z ending. For the package the MULTIPOINTZ is the same as MULTIPOINT. Problem could be solved when removing the 'Z' from the geometry type here: https://github.com/qwc-services/qwc-feature-info-service/blob/7f33d32837c7f16cba8a65108ccfd602252c9d9a/src/feature_info_service.py#L457

            if geomcentroid and geometry:
                gj = wkt.loads(geometry.upper().replace('Z',''))
                geometry = wkt.dumps({
                    "type": "Point",
                    "coordinates": geom_center(gj["type"], gj["coordinates"])
                })
                bbox = None

[2024-08-26 08:02:58,812] ERROR in app: Exception on /xxx [GET]
2024-08-26T08:02:58.812784547Z Traceback (most recent call last):
2024-08-26T08:02:58.812787047Z   File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1516, in full_dispatch_request
2024-08-26T08:02:58.812789047Z     rv = self.dispatch_request()
2024-08-26T08:02:58.812790547Z   File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1502, in dispatch_request
2024-08-26T08:02:58.812792147Z     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
2024-08-26T08:02:58.812793747Z   File "/usr/local/lib/python3.8/dist-packages/flask_restx/api.py", line 403, in wrapper
2024-08-26T08:02:58.812805247Z     resp = resource(*args, **kwargs)
2024-08-26T08:02:58.812811047Z   File "/usr/local/lib/python3.8/dist-packages/flask/views.py", line 84, in view
2024-08-26T08:02:58.812813947Z     return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
2024-08-26T08:02:58.812816347Z   File "/usr/local/lib/python3.8/dist-packages/flask_restx/resource.py", line 49, in dispatch_request
2024-08-26T08:02:58.812818947Z     resp = meth(*args, **kwargs)
2024-08-26T08:02:58.812821147Z   File "/usr/local/lib/python3.8/dist-packages/flask_jwt_extended/view_decorators.py", line 127, in decorator
2024-08-26T08:02:58.812823747Z     return current_app.ensure_sync(fn)(*args, **kwargs)
2024-08-26T08:02:58.812826147Z   File "/srv/qwc_service/./server.py", line 103, in get
2024-08-26T08:02:58.812828547Z     return self.__process_request(request.args, service_name)
2024-08-26T08:02:58.812830847Z   File "/srv/qwc_service/./server.py", line 141, in __process_request
2024-08-26T08:02:58.812833247Z     result = info_service.query(
2024-08-26T08:02:58.812836147Z   File "/srv/qwc_service/./feature_info_service.py", line 151, in query
2024-08-26T08:02:58.812837847Z     info = self.get_layer_info(
2024-08-26T08:02:58.812839247Z   File "/srv/qwc_service/./feature_info_service.py", line 412, in get_layer_info
2024-08-26T08:02:58.812840847Z     gj = wkt.loads(geometry.upper())
2024-08-26T08:02:58.812842347Z   File "/usr/local/lib/python3.8/dist-packages/geomet/wkt.py", line 135, in loads
2024-08-26T08:02:58.812844047Z     _unsupported_geom_type(geom_type)
2024-08-26T08:02:58.812845547Z   File "/usr/local/lib/python3.8/dist-packages/geomet/wkt.py", line 174, in _unsupported_geom_type
2024-08-26T08:02:58.812847747Z     raise ValueError("Unsupported geometry type '%s'" % geom_type)
2024-08-26T08:02:58.812849347Z ValueError: Unsupported geometry type 'MULTIPOINTZ'
manisandro commented 2 weeks ago

Thanks, could you submit a PR?