@ciag/sentinel-hub-wms
Version:
a API to create the sentinel ogs requests, and tools to apply on the data
39 lines • 1.33 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class SentinelHubURL {
constructor(preset = "https://services.sentinel-hub.com/ogc/wms/") {
this.preset = preset;
this.parameters = [];
this.request = "REQUEST=GetMap";
this.timeFrom = null;
this.timeTo = null;
}
addUUID(uuid) { this.UUID = uuid; }
addParameter(name, value) {
this.parameters.push(name + "=" + value);
}
setTimeFrom(date) {
this.timeFrom = "TIME=" + date.toISOString().split("T")[0];
}
setTimeTo(date) {
this.timeTo = "/" + date.toISOString().split("T")[0] + "/P1D";
}
clearTime() {
this.timeFrom = null;
this.timeTo = null;
}
getLink() {
this.link = this.preset + this.UUID + "?" + this.request + "&" + this.getLinkTime() + this.parameters.join("&");
return this.link;
}
getProxy() {
this.link = this.preset + '?' + this.request + "&" + this.getLinkTime() + this.parameters.join("&");
return this.link;
}
getLinkTime() {
return this.timeFrom ? (this.timeFrom + (this.timeTo ? this.timeTo : "")
+ "&") : "";
}
}
exports.SentinelHubURL = SentinelHubURL;
//# sourceMappingURL=SentinelHubURL.js.map