Avoid referring to repo[id] inside asynchronus code as this could already be removed again
This commit is contained in:
parent
c89a5ae029
commit
005bfe5620
1 changed files with 4 additions and 3 deletions
|
|
@ -723,7 +723,7 @@ module.exports = {
|
||||||
tileJSON.tiles = params.domains || options.domains;
|
tileJSON.tiles = params.domains || options.domains;
|
||||||
utils.fixTileJSONCenter(tileJSON);
|
utils.fixTileJSONCenter(tileJSON);
|
||||||
|
|
||||||
repo[id] = {
|
const repoobj = {
|
||||||
tileJSON,
|
tileJSON,
|
||||||
publicUrl,
|
publicUrl,
|
||||||
map,
|
map,
|
||||||
|
|
@ -731,6 +731,7 @@ module.exports = {
|
||||||
lastModified: new Date().toUTCString(),
|
lastModified: new Date().toUTCString(),
|
||||||
watermark: params.watermark || options.watermark
|
watermark: params.watermark || options.watermark
|
||||||
};
|
};
|
||||||
|
repo[id] = repoobj;
|
||||||
|
|
||||||
const queue = [];
|
const queue = [];
|
||||||
for (const name of Object.keys(styleJSON.sources)) {
|
for (const name of Object.keys(styleJSON.sources)) {
|
||||||
|
|
@ -771,11 +772,11 @@ module.exports = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!repo[id].dataProjWGStoInternalWGS && info.proj4) {
|
if (!repoobj.dataProjWGStoInternalWGS && info.proj4) {
|
||||||
// how to do this for multiple sources with different proj4 defs?
|
// how to do this for multiple sources with different proj4 defs?
|
||||||
const to3857 = proj4('EPSG:3857');
|
const to3857 = proj4('EPSG:3857');
|
||||||
const toDataProj = proj4(info.proj4);
|
const toDataProj = proj4(info.proj4);
|
||||||
repo[id].dataProjWGStoInternalWGS = xy => to3857.inverse(toDataProj.forward(xy));
|
repoobj.dataProjWGStoInternalWGS = xy => to3857.inverse(toDataProj.forward(xy));
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = source.type;
|
const type = source.type;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue