You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,21 @@
4
4
5
5
### Added
6
6
7
+
- HIERARCHICAL_LINKS array constant of all the types of hierarchical links (self is not included)
8
+
7
9
### Fixed
8
10
9
11
- Fixed error when accessing the statistics attribute of the pointcloud extension when no statistics were defined ([#282](https://github.com/stac-utils/pystac/pull/282))
10
12
- Fixed exception being thrown when calling set_self_href on items with assets that have relative hrefs ([#291](https://github.com/stac-utils/pystac/pull/291))
11
13
12
14
### Changed
13
15
16
+
- Link behavior - link URLs can be either relative or absolute. Hierarchical (e.g., parent, child) links are made relative or absolute based on the value of the root catalog's `catalog_type` field
17
+
14
18
### Removed
15
19
20
+
- Removed LinkType class and the `link_type` field from links
Copy file name to clipboardExpand all lines: docs/concepts.rst
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -155,14 +155,17 @@ Relative vs Absolute Link HREFs
155
155
156
156
Absolute links point to their file locations in a fully described way. Relative links
157
157
are relative to the linking object's file location. For example, if a catalog at
158
-
``/some/location/catalog.json`` has a link to an item that has an HREF set to ``item-id/item-id.json``, then that link should resolve to the absolute path ``/some/location/item-id/item-id.json``.
158
+
``/some/location/catalog.json`` has a link to an item that has an HREF set to ``item-id/item-id.json``,
159
+
then that link should resolve to the absolute path ``/some/location/item-id/item-id.json``.
159
160
160
-
The implementation of :class:`~pystac.Link` in PySTAC allows for the link to be marked as
161
-
``link_type=LinkType.ABSOLUTE`` or ``link_type=LinkType.RELATIVE``. This means that,
162
-
even if the stored HREF of the link is absolute, if the link is marked as relative, serializing
163
-
the link will produce a relative link, based on the self link of the parent object.
161
+
Links are set as absolute or relative HREFs at save time, as determine by the root catalog's catalog_type
162
+
:attribute:`~pystac.Catalog.catalog_type`. This means that, even if the stored HREF of the link is absolute,
163
+
if the root ``catalog_type=CatalogType.RELATIVE_PUBLISHED`` or ``catalog_type=CatalogType.SELF_CONTAINED``
164
+
and subsequent serializing of the any links in the catalog will produce a relative link,
165
+
based on the self link of the parent object.
164
166
165
-
You can make all the links of a catalog relative or absolute using the :func:`Catalog.make_all_links_relative <pystac.Catalog.make_all_links_relative>` and :func:`Catalog.make_all_links_absolute <pystac.Catalog.make_all_links_absolute>` methods.
167
+
You can make all the links of a catalog relative or absolute by setting the :func:`Catalog.catalog_type` field
Copy file name to clipboardExpand all lines: docs/tutorials/adding-new-and-custom-extensions.ipynb
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -181,7 +181,7 @@
181
181
"source": [
182
182
"The `from_item` class method simply returns a new instance of the item extension given an item.\n",
183
183
"\n",
184
-
"The `_object_links` class method returns the `rel` string for any links that point to STAC objects like Catalogs, Collections or Items. PySTAC needs to know which links point to STAC objects because it needs to consider them when fully resolving a STAC into in-memory objects. In a lot of cases, extensions don't add new links to STAC objects, so this is normally an empty list; however, if the extension does do this (like the `source` link in the [Label Extension](https://github.com/radiantearth/stac-spec/tree/v1.0.0-beta.2/extensions/label#links-source-imagery)), make sure to return the correct value (like the LabelItemExt is doing [here](https://github.com/azavea/pystac/blob/v0.5.0/pystac/extensions/label.py#L291-L293))."
184
+
"The `_object_links` class method returns the `rel` string for any links that point to STAC objects like Catalogs, Collections or Items. PySTAC needs to know which links point to STAC objects because it needs to consider them when fully resolving a STAC into in-memory objects. It also will use this information when deciding on whether to use absolute or relative HREFs for the links, based on the root catalog type. In a lot of cases, extensions don't add new links to STAC objects, so this is normally an empty list; however, if the extension does do this (like the `source` link in the [Label Extension](https://github.com/radiantearth/stac-spec/tree/v1.0.0-beta.2/extensions/label#links-source-imagery)), make sure to return the correct value (like the LabelItemExt is doing [here](https://github.com/azavea/pystac/blob/v0.5.0/pystac/extensions/label.py#L291-L293))."
0 commit comments