Skip to content

Commit 149d658

Browse files
committed
Merge branch 'main' into ol-stac
2 parents 309dddd + b85ab97 commit 149d658

40 files changed

+1570
-628
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ implemented as a single page application (SPA) for ease of development and to
88
limit the overall number of catalog reads necessary when browsing (as catalogs
99
may be nested and do not necessarily contain references to their parents).
1010

11-
Version: **3.3.3** (supports all STAC versions between 0.6.0 and 1.1.0)
11+
Version: **3.3.4** (supports all STAC versions between 0.6.0 and 1.1.0)
1212

1313
This package has also been published to npm as [`@radiantearth/stac-browser`](https://www.npmjs.com/package/@radiantearth/stac-browser).
1414

@@ -123,6 +123,7 @@ You need to change the [`locale`](docs/options.md#locale) and [`supportedLocales
123123

124124
The following languages are currently supported:
125125

126+
- Arabic `ar`
126127
- German `de` (Germany `de`, Switzerland `de-CH`)
127128
- Spanish `es`
128129
- English `en` (International `en`, US `en-US`, UK `en-GB`)
@@ -143,6 +144,7 @@ The following contributors kindly provide the translations:
143144
- [@m-mohr](https://github.com/m-mohr): `de`, `en`, `en-GB`, `en-US`
144145
- [@p1d1d1](https://github.com/p1d1d1): `de-CH`, `fr-CH`, `it`, `it-CH`
145146
- [@psacra](https://github.com/psacra): `pt`
147+
- [@randa-11295](https://github.com/randa-11295): `ar`
146148
- [@rnanclares](https://github.com/rnanclares): `es`
147149
- [@uba](https://github.com/uba): `pt-BR`
148150

assetActions.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import CopcViewer from './src/actions/assets/CopcViewer.js';
44
import F3D from './src/actions/assets/F3D.js';
55
import GeoJsonIo from './src/actions/assets/GeoJsonIo.js';
66
// import Geofox from './src/actions/assets/Geofox.js';
7-
// import Geoparquet from './src/actions/assets/Geoparquet.js';
87
// import Potree from './src/actions/assets/Potree.js';
98
import Protomaps from './src/actions/assets/Protomaps.js';
109

@@ -14,7 +13,6 @@ export default {
1413
CopcViewer,
1514
F3D,
1615
GeoJsonIo,
17-
// Geoparquet, // not ready yet
1816
// Potree,
1917
Protomaps,
20-
};
18+
};

config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
fallbackLocale: "en",
1010
supportedLocales: [
1111
"de",
12+
"ar",
1213
// "de-CH",
1314
"es",
1415
"en",

docs/actions.md

Lines changed: 79 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,124 @@
1-
# Actions
1+
# Actions <!-- omit in toc -->
22

33
STAC Browser has a pluggable interface to share or open assets and links with other services, which we call "actions".
44

55
An action adds a button to an asset or link if certain requirements are met, which can then be executed by users.
66
For example, you could open COPC files in a dedicated COPC Viewer, which otherwise you could only download.
77

8-
## Assets
8+
- [User Guide](#user-guide)
9+
- [Assets](#assets)
10+
- [Links](#links)
11+
- [Developer Guide](#developer-guide)
912

10-
All actions for assets are stored in the folder [`src/actions/assets`](../src/actions/assets).
11-
They all implement the [`AssetActionPlugin` interface](../src/actions/AssetActionPlugin.js).
12-
The actions can be enabled by adding them to the [`assetActions.config.js`](../assetActions.config.js) file.
13-
14-
### cogeo.xyz
13+
## User Guide
1514

16-
Adds an `Open in cogeo.xyz` button that allows to open Cloud-Optimized GeoTiff (COG) files on <https://cogeo.xyz>.
15+
### Assets
1716

18-
```js
19-
import CoGeoXyz from './src/actions/assets/CoGeoXyz.js';
20-
export default { CoGeoXyz };
21-
```
17+
The following actions are available:
2218

23-
### copc.io
19+
- `Cesium`: Allows to open OGC 3D Tiles (media type `application/3dtiles+json`) files through the Cesium Sandcastle at <https://sandcastle.cesium.com>.
20+
- `CopcViewer`: Allows to open Cloud-Optimized Point Cloud (COPC, media type `application/vnd.laszip+copc`) files through the Hobu COPC Viewer at <https://viewer.copc.io>.
21+
- `F3D`: Allows to open 3D models (media types `model/gltf-binary`, `model/gltf+json`, and `application/fbx`) files through the F3D Web App at <https://f3d.app/web>.
22+
- `Felt`: Allows to open GeoTIFF, GeoJON and KML/KMZ files through Felt at <https://felt.com/map/>.
23+
- `Geofox`: Allows to open OGC 3D Tiles (media type `application/3dtiles+json`) files through the 3D Assets Viewer at <https://viewer.geofox.ai>.
24+
- `GeoJsonIo`: Allows to open GeoJON files through [geojson.io](https://geojson.io).
25+
- `Potree`: Allows to open Cloud-Optimized Point Cloud (COPC, media type `application/vnd.laszip+copc`) and Potree files (file names `cloud.js`, `metadata.json`, `ept.json`) files through the Potree Viewer at <https://3d.iconem.com/apps/load_potree_project_from_urlparam/>.
26+
- `Protomaps`: Allows to open PMTiles (media type `application/vnd.pmtiles`) files through PMTiles Viewer at <https://pmtiles.io>.
2427

25-
Adds an `Open in copc.io` button that allows to open Cloud-Optimized Point Cloud (COPC) files on <https://viewer.copc.io>.
26-
27-
```js
28-
import CopcViewer from './src/actions/assets/CopcViewer.js';
29-
export default { CopcViewer };
30-
```
28+
All actions for assets are stored in the folder [`src/actions/assets`](../src/actions/assets) if you want to inspect them.
3129

32-
### Felt (Assets)
33-
34-
Adds an `Open in Felt` button that allows to import KML, KMZ, GeoTiff and GeoJSON assets to <https://felt.com>.
30+
The actions can be enabled by adding them to the [`assetActions.config.js`](../assetActions.config.js) file.
31+
Open the file and you'll see a number of imports and exports.
32+
Import the file for the action that you want to enable, e.g. for Felt:
3533

3634
```js
3735
import Felt from './src/actions/assets/Felt.js';
38-
export default { Felt };
3936
```
4037

41-
### geojson.io
38+
The path is fixed to `./src/actions/assets/`, the file extension is always `.js`.
39+
In-between add the file name from the list above.
40+
The import name should be the file name without extension (i.e. `Felt` again).
4241

43-
Adds an `Open in geojson.io` button that allows to open GeoJSON files on <https://geojson.io>.
42+
Lastly, add the import name to the list of exports, e.g.
4443

4544
```js
46-
import GeoJsonIo from './src/actions/assets/GeoJsonIo.js';
47-
export default { GeoJsonIo };
45+
export default {
46+
OtherAction,
47+
Felt
48+
};
4849
```
4950

50-
### OGC3dTiles
51-
52-
Adds an `Open in Geofox.ai` button that allows to open OGC 3D Tiles files on <https://viewer.geofox.ai> or Cesium Sandcastle.
53-
54-
```js
55-
import OGC3dTiles from './src/actions/assets/OGC3dTiles.js';
56-
export default { OGC3dTiles };
57-
```
51+
Save the file and restart / rebuild STAC Browser.
5852

59-
### geoparquet.info
53+
### Links
6054

61-
Adds an `Open in geoparquet.info` button that allows to open GeoParquet files on <https://geoparquet.info>.
55+
The following actions are available:
6256

63-
```js
64-
import Geoparquet from './src/actions/assets/Geoparquet.js';
65-
export default { Geoparquet };
66-
```
57+
- `Cesium`: Allows to open OGC 3D Tiles (relation type `3d-tiles`, see [web-map-links extension](https://github.com/stac-extensions/web-map-links/blob/v1.2.0/README.md#3d-tiles)) files through the Cesium Sandcastle at <https://sandcastle.cesium.com>.
58+
- `Felt`: Allows to open XYZ tile services (relation type `xyz`, see [web-map-links extension](https://github.com/stac-extensions/web-map-links/blob/v1.2.0/README.md#xyz)) files through Felt at <https://felt.com/map/>.
59+
- `Geofox`: Allows to open OGC 3D Tiles (relation type `3d-tiles`, see [web-map-links extension](https://github.com/stac-extensions/web-map-links/blob/v1.2.0/README.md#3d-tiles)) files through the 3D Assets Viewer at <https://viewer.geofox.ai>.
60+
- `Protomaps`: Allows to open PMTiles (relation type `pmtiles`, see [web-map-links extension](https://github.com/stac-extensions/web-map-links/blob/v1.2.0/README.md#pmtiles)) files through PMTiles Viewer at <https://pmtiles.io>.
6761

68-
### potree.org
62+
All actions for assets are stored in the folder [`src/actions/links`](../src/actions/links) if you want to inspect them.
6963

70-
Adds an `Open in potree.org` button that allows to open COPC and Potree files on <https://potree.org> (via [Darren Wiens](https://mpc-copc-viewer.netlify.app) or [Iconem](https://3d.iconem.com/apps/load_potree_project_from_urlparam) apps)
64+
The actions can be enabled by adding them to the [`linkActions.config.js`](../linkActions.config.js) file.
65+
Open the file and you'll see a number of imports and exports.
66+
Import the file for the action that you want to enable, e.g. for PMTiles / Protomaps:
7167

7268
```js
73-
import Potree from './src/actions/assets/Potree.js';
74-
export default { Potree };
69+
import Protomaps from './src/actions/links/Protomaps.js';
7570
```
7671

77-
### pmtiles.io
72+
The path is fixed to `./src/actions/links/`, the file extension is always `.js`.
73+
In-between add the file name from the list above.
74+
The import name should be the file name without extension (i.e. `Protomaps` again).
7875

79-
Adds an `Open in pmtiles.io` button that allows to open Protomaps PMTiles files on <https://pmtiles.io>.
76+
Lastly, add the import name to the list of exports, e.g.
8077

8178
```js
82-
import Protomaps from './src/actions/assets/Protomaps.js';
83-
export default { Protomaps };
79+
export default {
80+
OtherAction,
81+
Protomaps
82+
};
8483
```
8584

85+
Save the file and rebuild / restart STAC Browser.
8686

87+
## Developer Guide
8788

88-
## Links
89+
Implementing actions for assets and links follows a very similar pattern.
90+
The main difference is that assets implement the [`AssetActionPlugin` interface](../src/actions/AssetActionPlugin.js) while links implement the [`LinkActionPlugin` interface](../src/actions/LinkActionPlugin.js).
91+
Similarly, actions for assets are stored in the folder links are stored in the folder [`src/actions/assets`](../src/actions/assets) while links are stored in the folder [`src/actions/links`](../src/actions/links).
8992

90-
All actions for links are stored in the folder [`src/actions/links`](../src/actions/links).
91-
They all implement the [`LinkActionPlugin` interface](../src/actions/LinkActionPlugin.js).
92-
The actions can be enabled by adding them to the [`linkActions.config.js`](../linkActions.config.js) file.
93+
The interfaces for both look as follows:
9394

94-
### Felt (Links)
95+
- `constructor(data: object, component: Vue, id: string)`
96+
- `data`: The asset or link object, it is available in the class throuh `this.asset` (for assets) and `this.link` (for links).
97+
- `component`: The parent Asset/Link Vue component (available in the class through `this.component`)
98+
- `id`: Internal ID of the asset or link, not meant to be used.
99+
- `get btnOptions() : object`
100+
- This should return an object of button options, see [VueBootstrap b-button](https://bootstrap-vue.org/docs/components/button/#component-reference) for details. Returns `href`, `rel` (only for links) and `target` (set to `_blank`) by default.
101+
- `get onClick() : function(event: MouseEvent)`
102+
- Returns a function that accepts a [MouseEvent](https://developer.mozilla.org/de/docs/Web/API/MouseEvent). This is the action to execute in case no `href` is set.
103+
- `get uri() : string`
104+
- Reurns the URL to use as `href` for the button/link. This should a valid URL that a browser can navigate to, including the asset or link URL as a query parameter or so.
105+
- `get show() : boolean`
106+
- Return `true` if the action should be shown for the given asset or link. Return `false` otherwise, default to `false`.
107+
- `get text() : string`
108+
- Returns the text that is displayed for the button, defaults to "Open". Should be using the [i18n methods](https://kazupon.github.io/vue-i18n/api/#methods) to localize the text.
109+
- `get icon() : Vue`
110+
- Returns a Vue component that should be the icon for the button. Defaults to `BIconBoxArrowUpRight`, see <https://bootstrap-vue.org/docs/icons#icons-1> and search for `arrow-up-right`.
95111

96-
Adds an `Open in Felt` button that allows to show XYZ tile services on <https://felt.com>.
97-
The link to the XYZ has to follow the [web-map-links extension](https://github.com/stac-extensions/web-map-links/blob/v1.0.0/README.md#xyz).
112+
Each action should at least implement custom behaviour for `uri`, `show` and `text`.
98113

99-
```js
100-
import Felt from './src/actions/links/Felt.js';
101-
export default { Felt };
102-
```
114+
It is recommended to inspect the existing actions to get an impression of what is possible and how it is implemented.
103115

104-
### pmtiles.io
116+
Some notes:
105117

106-
Adds an `Open in pmtiles.io` button that allows to open Protomaps PMTiles files on <https://pmtiles.io>.
118+
- It is recommended to use [urijs](https://www.npmjs.com/package/urijs) for URL manipulations, it comes packages with STAC Browser anyway.
119+
- It can be helpful to use the Vue component that is available through `this.component`, for example:
120+
- `this.component.href` is the absolute asset URL (while `this.asset.href` could be relative or absolute)
121+
- `this.component.isBrowserProtocol` returns whether it's a http/https URL
122+
- `this.asset.type` / `this.link.type` contains the media type of the asset/link
107123

108-
```js
109-
import Protomaps from './src/actions/assets/Protomaps.js';
110-
export default { Protomaps };
111-
```
112-
113-
### OGC3dTiles
114-
115-
Adds an `Open in Geofox.ai` button that allows to open OGC 3D Tiles files on <https://viewer.geofox.ai> or Cesium Sandcastle.
116-
117-
```js
118-
import OGC3dTiles from './src/actions/assets/OGC3dTiles.js';
119-
export default { OGC3dTiles };
120-
```
124+
To enable a newly implemented action in STAC Browser, please follow the [User Guide](#user-guide).

0 commit comments

Comments
 (0)