Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better message on error on a WMTS layer #5443

Merged
merged 3 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions api/dist/apihelp/apihelp.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@ <h2>A map with several custom markers</h2>
center: [2544500, 1210100]
});
map.addMarker({
position: [544410, 210100],
position: [2544410, 1210100],
size: [14, 14],
icon: 'img/info.png'
});
map.addMarker({
position: [544450, 210000],
position: [2544450, 1210000],
size: [18, 18],
icon: 'img/essence.png'
});
map.addMarker({
position: [544310, 210200],
position: [2544310, 1210200],
size: [14, 14],
icon: 'img/parking.png'
});
Expand Down Expand Up @@ -162,11 +162,11 @@ <h2>Recenter the map to given coordinates</h2>
});
var button1 = document.getElementById('button1');
button1.onclick = function() {
map_.recenter([543500, 202154], 7);
map_.recenter([2543500, 1202154], 7);
}
var button2 = document.getElementById('button2');
button2.onclick = function() {
map_.recenter([564500, 216100], 9);
map_.recenter([2564500, 1216100], 9);
}
</pre>
</div>
Expand Down
9 changes: 7 additions & 2 deletions api/src/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export function createWMSLayer(config, ogcServer) {

/**
* @param {import('gmf/themes.js').GmfLayerWMTS} config Layer config (i.e. gmf layer node)
* @return {Promise<TileLayer>} Promise.
* @return {Promise<?TileLayer>} Promise.
* @hidden
*/
export function createWMTSLayer(config) {
Expand All @@ -250,7 +250,12 @@ export function createWMTSLayer(config) {
matrixSet: config.matrixSet
});
if (!options) {
throw new Error('Missing options');
console.log(
`Missing options for WMTS layer '${config.layer}', `
+ `with name '${config.name}', `
+ `from URL '${config.url}'.`
);
return null;
}
const source = new WMTS(options);
source.updateDimensions(config.dimensions);
Expand Down
2 changes: 1 addition & 1 deletion api/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default /** @type {APIConfig} */({

// The name of the layer to use as background, the layer must be present in the 'background_layers'
// section of the theme
backgroundLayer: 'orthophoto',
backgroundLayer: 'OSM map',

// The list of layers (names) that can be queried on mouse click
queryableLayers: ['osm_open', 'many_attributes', 'polygon']
Expand Down