forked from radiantearth/stac-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFelt.js
33 lines (27 loc) · 1.05 KB
/
Felt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { geojsonMediaType, geotiffMediaTypes } from "../../utils";
import AssetActionPlugin from "../AssetActionPlugin";
import URI from 'urijs';
import i18n from "../../i18n";
// For more options see https://feltmaps.notion.site/Upload-Anything-b26d739e80184127872faa923b55d232
const FELT_SUPPORTED_TYPES = geotiffMediaTypes.concat([
geojsonMediaType,
'application/vnd.google-earth.kml+xml',
'application/vnd.google-earth.kmz',
]);
export default class Felt extends AssetActionPlugin {
get show() {
return this.component.isBrowserProtocol && FELT_SUPPORTED_TYPES.includes(this.asset.type);
}
get uri() {
// Docs: https://feltmaps.notion.site/Open-in-Felt-Button-22765a3427ff45e0a70218dca3f8acc0
let uri = new URI("https://felt.com/map/new");
uri.addQuery('layer_urls[]', this.component.href);
// once we migrate to stac-js:
// todo: add title from STAC entity
// todo: add lat/lon from item/collection: lat=57.14926&lon=-2.09348
return uri;
}
get text() {
return i18n.t('actions.openIn', {service: 'Felt'});
}
}