@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
46 lines (45 loc) • 1.29 kB
JavaScript
export default class ServerOgc {
name;
url;
wfsSupport;
urlWfs;
oapifSupport;
urlOapif;
type;
imageType;
aliases;
constructor(name, elem) {
this.name = name;
this.url = elem.url;
this.wfsSupport = elem.wfsSupport;
this.urlWfs = elem.urlWfs;
this.oapifSupport = elem.oapifSupport ?? false;
this.urlOapif = elem.urlOapif;
this.type = elem.type;
this.imageType = elem.imageType;
this.aliases = this.initializeAliases(elem);
}
getAliasKey(table, column) {
return `${table}-${column}`;
}
initializeAliases(elem) {
const aliases = {};
if (elem.attributes) {
for (const [table, columns] of Object.entries(elem.attributes)) {
for (const [column, attributes] of Object.entries(columns)) {
if (attributes.alias) {
aliases[this.getAliasKey(table, column)] = attributes.alias;
}
}
}
}
return aliases;
}
getAlias(table, column) {
const key = this.getAliasKey(table, column);
return this.aliases[key];
}
get uniqueWmsQueryId() {
return this.name + this.imageType;
}
}