|
| 1 | +# Architecture |
| 2 | + |
| 3 | +What follows is some light documentation on how **stac-map** is built. |
| 4 | + |
| 5 | +## Core concepts |
| 6 | + |
| 7 | +Here's the two core concepts of **stac-map**. |
| 8 | + |
| 9 | +### Everything starts with the `href` |
| 10 | + |
| 11 | +**stac-map** is driven by one (and only one) `href` value, which is a URI to a remote file _or_ the name of an uploaded file. |
| 12 | +The `href` is stored in the app state and is synchronized with a URL parameter, which allows the sharing of links to **stac-map** pointed at a specific STAC value. |
| 13 | + |
| 14 | +### The value could be (almost) anything |
| 15 | + |
| 16 | +Once the `href` is set, the data at the `href` is loaded into the app as a single `value`. |
| 17 | +The `value` could be: |
| 18 | + |
| 19 | +- A STAC [Catalog](https://github.com/radiantearth/stac-spec/blob/master/catalog-spec/catalog-spec.md), [Collection](https://github.com/radiantearth/stac-spec/blob/master/collection-spec/collection-spec.md), or [Item](https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md) |
| 20 | +- A STAC [API](https://github.com/radiantearth/stac-api-spec) |
| 21 | +- A GeoJSON [FeatureCollection](https://datatracker.ietf.org/doc/html/rfc7946#section-3.3) with STAC Items as its `features` (commonly referred to as an `ItemCollection`, though no such term exists in the STAC specification) |
| 22 | +- A [stac-geoparquet](https://github.com/stac-utils/stac-geoparquet) file, which is treated as an `ItemCollection`. |
| 23 | + |
| 24 | +The behaviors of the app are then driven by the attributes of the `value`. |
| 25 | + |
| 26 | +## Concept diagram |
| 27 | + |
| 28 | +Any values that don't have a parent are set by the user, either directly (e.g. `href`) or by interacting with the app (e.g. `bbox`). |
| 29 | + |
| 30 | +```mermaid |
| 31 | +flowchart TD |
| 32 | + h[href] --> value; |
| 33 | + value --> catalogs; |
| 34 | + value --> collections; |
| 35 | + collections --> filteredCollections; |
| 36 | + bbox --> filteredCollections; |
| 37 | + datetimeBounds --> filteredCollections; |
| 38 | + value --> linkedItems; |
| 39 | + linkedItems -- if no user items --> items; |
| 40 | + search --> userItems; |
| 41 | + userItems --> items; |
| 42 | + items --> filteredItems; |
| 43 | + bbox --> filteredItems; |
| 44 | + datetimeBounds --> filteredItems; |
| 45 | +``` |
0 commit comments