From 0c357bc3a36a0a2cd5800e40736dd901be63e2ac Mon Sep 17 00:00:00 2001 From: David Manthey Date: Mon, 25 Nov 2024 12:56:49 -0500 Subject: [PATCH] Better handle geojson label properties --- CHANGELOG.md | 1 + .../girder_large_image_annotation/utils/__init__.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09712db17..3be895010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Better scale float-valued tiles ([#1725](../../pull/1725)) - Tile iterators now report their length ([#1730](../../pull/1730)) - When using griddata annotations as heatmaps, allow setting scaleWithZoom ([#1731](../../pull/1731)) +- Handle any sort of label as an extra property when importing geojson annotations ([#1732](../../pull/1732)) ### Changes diff --git a/girder_annotation/girder_large_image_annotation/utils/__init__.py b/girder_annotation/girder_large_image_annotation/utils/__init__.py index 43b4173a0..3a29cfc0e 100644 --- a/girder_annotation/girder_large_image_annotation/utils/__init__.py +++ b/girder_annotation/girder_large_image_annotation/utils/__init__.py @@ -264,6 +264,10 @@ def _parseFeature(self, geoelem): 'fillColor', 'radius', 'width', 'height', 'rotation', 'normal', }} + if 'label' in element: + if not isinstance(element['label'], dict): + element['label'] = {'value': element['label']} + element['label']['value'] = str(element['label']['value']) if 'annotation' in geoelem.get('properties', {}): self._annotation.update(geoelem['properties']['annotation']) self._annotation['elements'] = self._elements