Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const options = {
id: id,
name: layer.Title,
ogcImageType: ogcImageType,
wmsLayers: [{
name: layer.Name,
queryable: queryable
}],
ogcType: Type.WMS,
visible: true,
wmsUrl: url
};
if (wmsInfoFormat) {
options.wmsInfoFormat = wmsInfoFormat;
}
dataSource = new ngeoDatasourceOGC(options);
// Keep a reference to the external data source in the cache
this.extDataSources_[id] = dataSource;
}
// (2) Add data source in WMS group, unless it's already in there.
// Will also add the data source to the `import('ngeo/datasource/DataSource.js').DataSources`
// collection.
// If the group is created, its inner OL layer is also added to the map.
let wmsGroup = this.getWMSGroup(url);
if (wmsGroup) {
if (!wmsGroup.dataSources.includes(dataSource)) {
wmsGroup.addDataSource(dataSource);
this.dataSources_.push(dataSource);
}
}
/** @type {ngeoDatasourceOGC|ngeoDatasourceFile} */
let dataSource;
// (2) Get data source from cache if it exists, otherwise create it
if (this.extDataSources_[id]) {
dataSource = this.extDataSources_[id];
} else {
const name = typeof layer.Title;
const wmtsLayer = typeof layer.Identifier;
// TODO - MaxScaleDenominator
// TODO - MinScaleDenominator
dataSource = new ngeoDatasourceOGC({
id: id,
name: name,
ogcType: Type.WMTS,
visible: true,
wmtsLayer: wmtsLayer,
wmtsUrl: wmtsUrl
});
// Keep a reference to the external data source in the cache
this.extDataSources_[id] = dataSource;
}
// (3) Get/Create group, then add data source to group
let wmtsGroup = this.getWMTSGroup(wmtsUrl);
if (!wmtsGroup) {
wmtsGroup = new ngeoDatasourceOGCGroup({
});
ngeoDataSources.map = this.map;
ngeoDataSources.collection.push(new ngeoDatasourceOGC({
id: 1,
name: 'bus_stop',
visible: true,
wmsUrl: MAPSERVER_PROXY,
ogcLayers: [{
name: 'bus_stop',
queryable: true
}]
}));
ngeoDataSources.collection.push(new ngeoDatasourceOGC({
id: 2,
name: 'information',
visible: true,
wmsUrl: MAPSERVER_PROXY,
ogcLayers: [{
name: 'information',
queryable: true
}]
}));
const queryToolActivate = new ngeoMiscToolActivate(this, 'queryActive');
ngeoToolActivateMgr.registerTool('mapTools', queryToolActivate, true);
const dummyToolActivate = new ngeoMiscToolActivate(this, 'dummyActive');
ngeoToolActivateMgr.registerTool('mapTools', dummyToolActivate);
source: new olSourceOSM()
}),
informationLayer,
busStopLayer
],
view: new olView({
projection: EPSG21781,
resolutions: [200, 100, 50, 20, 10, 5, 2.5, 2, 1, 0.5],
center: [537635, 152640],
zoom: 0
})
});
ngeoDataSources.map = this.map;
ngeoDataSources.collection.push(new ngeoDatasourceOGC({
id: 1,
name: 'bus_stop',
visible: true,
wfsFeatureNS: MAPSERVER_WFS_FEATURE_NS,
wfsUrl: MAPSERVER_PROXY,
ogcLayers: [{
name: 'bus_stop',
queryable: true
}]
}));
ngeoDataSources.collection.push(new ngeoDatasourceOGC({
id: 2,
name: 'information',
visible: true,
wfsFeatureNS: MAPSERVER_WFS_FEATURE_NS,
source: new olSourceOSM()
}),
informationLayer,
busStopLayer
],
view: new olView({
projection: EPSG2056,
resolutions: [200, 100, 50, 20, 10, 5, 2.5, 2, 1, 0.5],
center: [2536660, 1153009],
zoom: 4
})
});
ngeoDataSources.map = this.map;
ngeoDataSources.collection.push(new ngeoDatasourceOGC({
id: 1,
name: 'bus_stop',
visible: true,
wmsUrl: MAPSERVER_PROXY,
wmsLayers: [{
name: 'bus_stop',
queryable: true
}],
wfsUrl: MAPSERVER_PROXY,
wfsFeatureNS: MAPSERVER_WFS_FEATURE_NS,
wfsLayers: [{
name: 'bus_stop',
queryable: true
}]
}));