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

feat(cli): Update a preview url for zoom level changes. #2699

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions packages/cli/src/cli/config/action.import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,30 @@ export class CommandImport extends CommandLineAction {
if (layer.name === 'chatham-islands_digital-globe_2014-2019_0-5m') continue; // Ignore duplicated layer.
const existing = oldData.layers.find((l) => l.name === layer.name);
if (existing) {
const change: string[] = [`### ${layer.name}\n`];
let zoom = undefined;
if (layer.minZoom !== existing.minZoom || layer.maxZoom !== existing.maxZoom) {
let msg = ' - Zoom level updated.';
if (layer.minZoom !== existing.minZoom) msg += ` min zoom ${existing.minZoom} -> ${layer.minZoom}`;
if (layer.maxZoom !== existing.maxZoom) msg += ` max zoom ${existing.maxZoom} -> ${layer.maxZoom}`;
change.push(`${msg}\n`);
zoom = ' - Zoom level updated.';
if (layer.minZoom !== existing.minZoom) zoom += ` min zoom ${existing.minZoom} -> ${layer.minZoom}`;
if (layer.maxZoom !== existing.maxZoom) zoom += ` max zoom ${existing.maxZoom} -> ${layer.maxZoom}`;
}
if (layer[2193] && layer[2193] !== existing[2193]) {

const change: string[] = [`### ${layer.name}\n`];
if (layer[2193]) {
const urls = await this.prepareUrl(layer[2193], mem, Nztm2000QuadTms);
change.push(`- Layer update [NZTM2000Quad](${urls.layer}) -- [Aerial](${urls.tag})\n`);
if (layer[2193] !== existing[2193]) {
change.push(`- Layer update [NZTM2000Quad](${urls.layer}) -- [Aerial](${urls.tag})\n`);
}
if (zoom) zoom += ` [NZTM2000Quad](${urls.tag})`;
}
if (layer[3857] && layer[3857] !== existing[3857]) {
if (layer[3857]) {
const urls = await this.prepareUrl(layer[3857], mem, GoogleTms);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need brackets here.

change.push(`- Layer update [WebMercatorQuad](${urls.layer}) -- [Aerial](${urls.tag})\n`);
if (layer[3857] !== existing[3857]) {
change.push(`- Layer update [WebMercatorQuad](${urls.layer}) -- [Aerial](${urls.tag})\n`);
}
if (zoom) zoom += ` [WebMercatorQuad](${urls.tag})`;
}

if (zoom) change.push(zoom);
if (change.length > 1) updates.push(change.join(''));
} else {
// New layers
Expand Down