forked from radiantearth/stac-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProtomaps.js
More file actions
30 lines (24 loc) · 858 Bytes
/
Protomaps.js
File metadata and controls
30 lines (24 loc) · 858 Bytes
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
import AssetActionPlugin from "../AssetActionPlugin";
import URI from 'urijs';
import i18n from "../../i18n";
// obj & ply files are usually with mime-type text/plain
const PROTOMAPS_SUPPORTED_TYPES = [
'application/vnd.pmtiles',
];
export default class Protomaps extends AssetActionPlugin {
get show() {
// Rather check if .pmtiles substring present in this.asset.href or simply this.component.filename.endsWith('pmtiles')
return this.component.isBrowserProtocol && (
PROTOMAPS_SUPPORTED_TYPES.includes(this.asset.type)
|| URI(this.asset.href).suffix() == 'pmtiles'
);
}
get uri() {
let uri = new URI("https://pmtiles.io/");
uri.addQuery("url", this.component.href); // returns the URI instance for chaining
return uri;
}
get text() {
return i18n.t('actions.openIn', {service: 'Protomaps'});
}
}