Skip to content

Commit

Permalink
Fix FeatureProjection.main_geometry_element detection
Browse files Browse the repository at this point in the history
It was comparing GeometryField vs GmlElement, which was always false
  • Loading branch information
vdboor committed Dec 11, 2024
1 parent 4e64494 commit 63af34c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions gisserver/queries/projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from collections import defaultdict
from dataclasses import dataclass
from functools import cached_property
from typing import cast

from django.db import models

Expand Down Expand Up @@ -119,12 +118,11 @@ def main_geometry_element(self) -> GmlElement | None:
"""Return the field used to describe the geometry of the feature.
When the projection excludes the geometry, ``None`` is returned.
"""
main_field = self.feature_type.geometry_field
if self.property_names and main_field not in self.xsd_root_elements:
gml_element = self.feature_type.main_geometry_element
if self.property_names and gml_element not in self.xsd_root_elements:
return None

xpath_match = self.feature_type.resolve_element(main_field)
return cast(GmlElement, xpath_match.child)
return gml_element

@cached_property
def orm_relations(self) -> list[FeatureRelation]:
Expand Down

0 comments on commit 63af34c

Please sign in to comment.