Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ asset extension renamed to item-assets and renamed assets field in Collections t
### Removed

- ItemCollection was removed. ([#123](https://github.com/azavea/pystac/pull/123))
- The commons extension was removed. Collection properties will still be merged for pre-1.0.0-beta.1 items where appropriate ([#129](https://github.com/azavea/pystac/pull/129))

## [v0.4.0]

Expand Down
8 changes: 4 additions & 4 deletions docs/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ and any custom extensions (represented by URIs to JSON Schemas).

json_dict = ...

info = identify_stac_object(json_dict, merge_collection_properties=True)
info = identify_stac_object(json_dict)

# The object type
info.object_type
Expand All @@ -461,7 +461,7 @@ and any custom extensions (represented by URIs to JSON Schemas).
Merging common properties
-------------------------

The :func:`~pystac.serialization.merge_common_properties` will take a JSON dict that represents
an item, and if it is associated with a collection, merge in the collection's properties.
You can pass in a dict that contains previously read collections that caches collections by the HREF of the collection link and/or the collection ID, which can help avoid multiple reads of
For pre-1.0.0 STAC, The :func:`~pystac.serialization.merge_common_properties` will take a JSON dict that represents an item, and if it is associated with a collection, merge in the collection's properties. You can pass in a dict that contains previously read collections that caches collections by the HREF of the collection link and/or the collection ID, which can help avoid multiple reads of
collection links.

Note that this feature was dropped in STAC 1.0.0-beta.1
4 changes: 1 addition & 3 deletions pystac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ class STACError(Exception):
STAC_IO.stac_object_from_dict = stac_object_from_dict

from pystac import extensions
import pystac.extensions.commons
import pystac.extensions.eo
import pystac.extensions.label
import pystac.extensions.projection
import pystac.extensions.view
import pystac.extensions.single_file_stac

STAC_EXTENSIONS = extensions.base.RegisteredSTACExtensions([
extensions.commons.COMMONS_EXTENSION_DEFINITION, extensions.eo.EO_EXTENSION_DEFINITION,
extensions.label.LABEL_EXTENSION_DEFINITION,
extensions.eo.EO_EXTENSION_DEFINITION, extensions.label.LABEL_EXTENSION_DEFINITION,
extensions.projection.PROJECTION_EXTENSION_DEFINITION,
extensions.view.VIEW_EXTENSION_DEFINITION, extensions.single_file_stac.SFS_EXTENSION_DEFINITION
])
Expand Down
1 change: 0 additions & 1 deletion pystac/extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Extensions:
"""Enumerates the IDs of common extensions."""
ASSETS = 'asset'
CHECKSUM = 'checksum'
COMMONS = 'commons'
DATACUBE = 'datacube'
DATETIME_RANGE = 'datetime-range'
EO = 'eo'
Expand Down
82 changes: 0 additions & 82 deletions pystac/extensions/commons.py

This file was deleted.

1 change: 1 addition & 0 deletions pystac/serialization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def stac_object_from_dict(d, href=None, root=None):
if root is not None:
collection_cache = root._resolved_objects.as_collection_cache()

# Merge common properties in case this is an older STAC object.
merge_common_properties(d, json_href=href, collection_cache=collection_cache)

info = identify_stac_object(d)
Expand Down
12 changes: 9 additions & 3 deletions pystac/serialization/common_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ def merge_common_properties(item_dict, collection_cache=None, json_href=None):
collection_id = None
collection_href = None

# Check to see if this is an item 0.9 or later that
stac_version = item_dict.get('stac_version')

# The commons extension was removed in 1.0.0-beta.1, so if this is an earlier STAC
# item we don't have to bother with merging.
if stac_version is not None and not stac_version.startswith('0.'):
return False

# Check to see if this is a 0.9.0 item that
# doesn't extend the commons extension, in which case
# we don't have to merge.
stac_version = item_dict.get('stac_version')
if stac_version is not None and stac_version >= '0.9.0':
if stac_version is not None and stac_version == '0.9.0':
stac_extensions = item_dict.get('stac_extensions')
if type(stac_extensions) is list:
if 'commons' not in stac_extensions:
Expand Down
3 changes: 2 additions & 1 deletion pystac/serialization/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def _migrate_single_file_stac(d, version, info):
_removed_extension_migrations = {
# Removed in 0.9.0
'dtr': _migrate_datetime_range,
'datetime-range': _migrate_datetime_range
'datetime-range': _migrate_datetime_range,
'commons': lambda a, b, c: None # No changes needed, just remove the extension_id
}


Expand Down
61 changes: 0 additions & 61 deletions tests/extensions/test_commons.py

This file was deleted.