Skip to content

Commit ce21599

Browse files
authored
fix: deprecate the label extension (#1270)
1 parent c0b12a8 commit ce21599

19 files changed

+126
-2193
lines changed

.coveragerc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ exclude_lines =
77
[run]
88
branch = true
99
source =
10-
pystac
10+
pystac
11+
omit =
12+
pystac/extensions/label.py
13+

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
- `ExtensionManagementMixin.validate_has_extension` is replaced with `ExtensionManagementMixin.ensure_has_extension`. Calling `ExtensionManagementMixin.validate_has_extension` will raise a `DeprecationWarning` and call `ExtensionManagementMixin.ensure_has_extension` ([#1248](https://github.com/stac-utils/pystac/pull/1248))
3232
- `validate_all` for dicts; use `validate_all_dict` instead ([#1246](https://github.com/stac-utils/pystac/pull/1246))
33+
- `Label` extension ([#1270](https://github.com/stac-utils/pystac/pull/1270))
3334

3435
## [v1.8.4] - 2023-09-22
3536

docs/api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ PySTAC provides support for the following STAC Extensions:
9595
* :mod:`Electro-Optical <pystac.extensions.eo>`
9696
* :mod:`File Info <pystac.extensions.file>`
9797
* :mod:`Item Assets <pystac.extensions.item_assets>`
98-
* :mod:`Label <pystac.extensions.label>`
9998
* :mod:`MGRS <pystac.extensions.mgrs>`
10099
* :mod:`Point Cloud <pystac.extensions.pointcloud>`
101100
* :mod:`Projection <pystac.extensions.projection>`

docs/api/extensions.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pystac.extensions
1919
file.FileExtension
2020
grid.GridExtension
2121
item_assets.ItemAssetsExtension
22-
label.LabelExtension
2322
mgrs.MgrsExtension
2423
pointcloud.PointcloudExtension
2524
projection.ProjectionExtension

docs/api/extensions/label.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/concepts.rst

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -681,44 +681,25 @@ Mapping over Items
681681
------------------
682682
683683
The :func:`Catalog.map_items <pystac.Catalog.map_items>` method is useful for
684+
into smaller chunks (e.g. tiling out large image items).
685+
item, you can return multiple items, in case you are generating new objects, or splitting items
684686
manipulating items in a STAC. This will create a full copy of the STAC, so will leave
685687
the original catalog unmodified. In the method that manipulates and returns the modified
686-
item, you can return multiple items, in case you are generating new objects (e.g.
687-
creating a :class:`~pystac.LabelItem` for image items in a stac), or splitting items
688-
into smaller chunks (e.g. tiling out large image items).
689688
690689
.. code-block:: python
691690
692691
def modify_item_title(item):
693692
item.title = 'Some new title'
694693
return item
695694
696-
def create_label_item(item):
697-
# Assumes the GeoJSON labels are in the
698-
# same location as the image
699-
img_href = item.assets['ortho'].href
700-
label_href = '{}.geojson'.format(os.path.splitext(img_href)[0])
701-
label_item = LabelItem(id='Labels',
702-
geometry=item.geometry,
703-
bbox=item.bbox,
704-
datetime=datetime.utcnow(),
705-
properties={},
706-
label_description='labels',
707-
label_type='vector',
708-
label_properties='label',
709-
label_classes=[
710-
LabelClasses(classes=['one', 'two'],
711-
name='label')
712-
],
713-
label_tasks=['classification'])
714-
label_item.add_source(item, assets=['ortho'])
715-
label_item.add_geojson_labels(label_href)
716-
717-
return [item, label_item]
695+
def duplicate_item(item):
696+
duplicated_item = item.clone()
697+
duplicated_item.id += "-duplicated"
698+
return [item, duplicated_item]
718699
719700
720701
c = catalog.map_items(modify_item_title)
721-
c = c.map_items(create_label_item)
702+
c = c.map_items(duplicate_item)
722703
new_catalog = c
723704
724705
.. _copy stacs:
@@ -731,11 +712,7 @@ and mutations of STAC data. The :func:`STACObject.full_copy
731712
<pystac.STACObject.full_copy>` mechanism handles this in a way that ties the elements of
732713
the copies STAC together correctly. This includes situations where there might be cycles
733714
in the graph of connected objects of the STAC (which otherwise would be `a tree
734-
<https://en.wikipedia.org/wiki/Tree_(graph_theory)>`_). For example, if a
735-
:class:`~pystac.LabelItem` lists a :attr:`~pystac.LabelItem.source` that is an item also
736-
contained in the root catalog; the full copy of the STAC will ensure that the
737-
:class:`~pystac.Item` instance representing the source imagery item is the same instance
738-
that is linked to by the :class:`~pystac.LabelItem`.
715+
<https://en.wikipedia.org/wiki/Tree_(graph_theory)>`_).
739716
740717
Resolving STAC objects
741718
======================

docs/tutorials.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ How to create STAC Catalogs with PySTAC
3636
This was a tutorial that was part of a 30 minute presentation at the `community STAC
3737
sprint
3838
<https://github.com/radiantearth/community-sprints/tree/master/11052019-arlignton-va>`_
39-
in Arlington, VA in November 2019. It runs through creating a STAC of image or label
40-
items from the `SpaceNet 5 <https://www.topcoder.com/challenges/30099956>`_ dataset.
39+
in Arlington, VA in November 2019. It runs through creating a STAC of images
40+
from the `SpaceNet 5 <https://www.topcoder.com/challenges/30099956>`_ dataset.
4141

4242
Creating a Landsat 8 STAC
4343
-------------------------

0 commit comments

Comments
 (0)