Skip to content

Commit

Permalink
Better handle geojson label properties
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Nov 25, 2024
1 parent 6f96231 commit 0c357bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

Check warning on line 270 in girder_annotation/girder_large_image_annotation/utils/__init__.py

View check run for this annotation

Codecov / codecov/patch

girder_annotation/girder_large_image_annotation/utils/__init__.py#L269-L270

Added lines #L269 - L270 were not covered by tests
if 'annotation' in geoelem.get('properties', {}):
self._annotation.update(geoelem['properties']['annotation'])
self._annotation['elements'] = self._elements
Expand Down

0 comments on commit 0c357bc

Please sign in to comment.