Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tiles extension demo #309

Merged
merged 2 commits into from
Dec 14, 2021
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

### Removed

* The tiles extension and all tiles links, added for demonstration purposes, have been removed. ([#309](https://github.com/stac-utils/stac-fastapi/pull/309))

### Fixed

* Enabled `ContextExtension` by default ([#207](https://github.com/stac-utils/stac-fastapi/issues/207))
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pybase-install:
pip install wheel && \
pip install -e ./stac_fastapi/api[dev] && \
pip install -e ./stac_fastapi/types[dev] && \
pip install -e ./stac_fastapi/extensions[dev,tiles]
pip install -e ./stac_fastapi/extensions[dev]

.PHONY: pgstac-install
pgstac-install: pybase-install
Expand Down
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ nav:
- transaction: api/stac_fastapi/extensions/core/transaction.md
- third_party:
- bulk_transactions: api/stac_fastapi/extensions/third_party/bulk_transactions.md
- tiles: api/stac_fastapi/extensions/third_party/tiles.md
- stac_fastapi.server:
- app: api/stac_fastapi/server/app.md
- stac_fastapi.sqlalchemy:
Expand Down
1 change: 0 additions & 1 deletion stac_fastapi/api/stac_fastapi/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ class ApiExtensions(enum.Enum):
class AddOns(enum.Enum):
"""Enumeration of available third party add ons."""

tiles = "tiles"
bulk_transaction = "bulk-transaction"
1 change: 0 additions & 1 deletion stac_fastapi/extensions/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"requests",
],
"docs": ["mkdocs", "mkdocs-material", "pdocs"],
"tiles": ["titiler==0.2.*"],
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""stac_api.extensions.core module."""
from stac_fastapi.extensions.third_party.tiles import TilesExtension

from .context import ContextExtension
from .fields import FieldsExtension
from .filter import FilterExtension
Expand All @@ -16,7 +14,6 @@
"PaginationExtension",
"QueryExtension",
"SortExtension",
"TilesExtension",
"TokenPaginationExtension",
"TransactionExtension",
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""stac_api.extensions.third_party module."""
from .bulk_transactions import BulkTransactionExtension
from .tiles import TilesExtension

__all__ = ("BulkTransactionExtension", "TilesExtension")
__all__ = ("BulkTransactionExtension",)
215 changes: 0 additions & 215 deletions stac_fastapi/extensions/stac_fastapi/extensions/third_party/tiles.py

This file was deleted.

2 changes: 1 addition & 1 deletion stac_fastapi/pgstac/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ cd stac-fastapi
pip install -e \
stac_fastapi/api[dev] \
stac_fastapi/types[dev] \
stac_fastapi/extensions[dev,tiles] \
stac_fastapi/extensions[dev] \
stac_fastapi/pgstac[dev,server]
```

Expand Down
70 changes: 0 additions & 70 deletions stac_fastapi/pgstac/stac_fastapi/pgstac/models/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,73 +225,3 @@ def link_parent(self) -> Dict:
def link_collection(self) -> Dict:
"""Create the `collection` link."""
return self.collection_link()

def link_tiles(self) -> Dict:
"""Create the `tiles` link."""
return dict(
rel=Relations.alternate.value,
type=MimeTypes.json.value,
title="tiles",
href=self.resolve(
f"collections/{self.collection_id}/items/{self.item_id}/tiles",
),
)


@attr.s
class TileLinks:
"""Create inferred links specific to OGC Tiles API."""

base_url: str = attr.ib()
collection_id: str = attr.ib()
item_id: str = attr.ib()

def __post_init__(self):
"""Post init handler."""
self.item_uri = urljoin(
self.base_url,
f"collections/{self.collection_id}/items/{self.item_id}",
)

def link_tiles(self) -> Dict:
"""Create tiles link."""
return dict(
href=urljoin(
self.base_url,
f"titiler/tiles/{{z}}/{{x}}/{{y}}.png?url={self.item_uri}",
),
rel=Relations.item.value,
title="tiles",
type=MimeTypes.png.value,
templated=True,
)

def link_viewer(self) -> Dict:
"""Create viewer link."""
return dict(
href=urljoin(self.base_url, f"titiler/viewer?url={self.item_uri}"),
rel=Relations.alternate.value,
type=MimeTypes.html.value,
title="viewer",
)

def link_tilejson(self) -> Dict:
"""Create tilejson link."""
return dict(
href=urljoin(self.base_url, f"titiler/tilejson.json?url={self.item_uri}"),
rel=Relations.alternate.value,
type=MimeTypes.json.value,
title="tilejson",
)

def link_wmts(self) -> Dict:
"""Create wmts capabilities link."""
return dict(
href=urljoin(
self.base_url,
f"titiler/WMTSCapabilities.xml?url={self.item_uri}",
),
rel=Relations.alternate.value,
type=MimeTypes.xml.value,
title="WMTS Capabilities",
)
15 changes: 0 additions & 15 deletions stac_fastapi/types/stac_fastapi/types/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,6 @@ def collection(self) -> Dict[str, Any]:
href=urljoin(self.base_url, f"collections/{self.collection_id}"),
)

def tiles(self) -> Dict[str, Any]:
"""Create the `tiles` link."""
return dict(
rel=Relations.alternate,
type=MimeTypes.json,
title="tiles",
href=urljoin(
self.base_url,
f"collections/{self.collection_id}/items/{self.item_id}/tiles",
),
)

def create_links(self) -> List[Dict[str, Any]]:
"""Return all inferred links."""
links = [
Expand All @@ -119,7 +107,4 @@ def create_links(self) -> List[Dict[str, Any]]:
self.collection(),
self.root(),
]
# if config.settings.add_on_is_enabled(config.AddOns.tiles):
# TODO: Don't always append tiles link
links.append(self.tiles())
return links