def add_item( self, item: "Item_Type", title: Optional[str] = None, strategy: Optional[HrefLayoutStrategy] = None, ) -> None: """Adds a link to an :class:`~pystac.Item`. This method will set the item's parent to this object, and its root to this Catalog's root. Args: item : The item to add. title : Optional title to give to the :class:`~pystac.Link` """ # Prevent typo confusion if isinstance(item, pystac.Catalog): raise pystac.STACError("Cannot add catalog as item. Use add_child instead.") if strategy is None: strategy = BestPracticesLayoutStrategy() item.set_root(self.get_root()) item.set_parent(self) # set self link self_href = self.get_self_href() if self_href: item_href = strategy.get_href(item, os.path.dirname(self_href)) item.set_self_href(item_href) self.add_link(Link.item(item, title=title))
def add_item(self, item, title=None): """Adds a link to an :class:`~pystac.Item`. This method will set the item's parent to this object, and its root to this Catalog's root. Args: item (Item): The item to add. title (str): Optional title to give to the :class:`~pystac.Link` """ # Prevent typo confusion if isinstance(item, pystac.Catalog): raise STACError('Cannot add catalog as item. Use add_child instead.') item.set_root(self.get_root()) item.set_parent(self) self.add_link(Link.item(item, title=title))
def add_item(self, item, title=None): item.set_root(self.get_root()) item.set_parent(self) self.add_link(Link.item(item, title=title))