diff --git a/packages/compass-schema/src/components/coordinates-minichart/constants.js b/packages/compass-schema/src/components/coordinates-minichart/constants.js index ffaa8f17d96..664e475b472 100644 --- a/packages/compass-schema/src/components/coordinates-minichart/constants.js +++ b/packages/compass-schema/src/components/coordinates-minichart/constants.js @@ -1,10 +1,10 @@ 'use strict'; const LIGHTMODE_TILE_URL = - 'https://compass-maps.mongodb.com/compass/maptile/reduced.day/{z}/{x}/{y}/512'; + 'https://compass-maps.mongodb.com/compass/maptile/v3/lite.day/{z}/{x}/{y}/512'; const DARKMODE_TILE_URL = - 'https://compass-maps.mongodb.com/compass/maptile/reduced.night/{z}/{x}/{y}/512'; + 'https://compass-maps.mongodb.com/compass/maptile/v3/lite.night/{z}/{x}/{y}/512'; // The copyright url for HERE maps, if we're using the default tile url -const COPYRIGHT_URL = 'https://compass-maps.mongodb.com/compass/copyright'; +const COPYRIGHT_URL = 'https://compass-maps.mongodb.com/compass/copyright/v3'; export { LIGHTMODE_TILE_URL, DARKMODE_TILE_URL, COPYRIGHT_URL }; diff --git a/packages/compass-schema/src/components/coordinates-minichart/utils.js b/packages/compass-schema/src/components/coordinates-minichart/utils.js index a2ac7b8f799..192e0f89ca0 100644 --- a/packages/compass-schema/src/components/coordinates-minichart/utils.js +++ b/packages/compass-schema/src/components/coordinates-minichart/utils.js @@ -1,3 +1,4 @@ +import _ from 'lodash'; import L from 'leaflet'; import { COPYRIGHT_URL } from './constants'; @@ -9,15 +10,25 @@ const thisYear = new Date().getFullYear(); * @returns {Array} Array of attribution objects { label, alt, boxes, minLevel, maxLevel } */ export async function _getHereTileBoxes() { - const rawTileBoxes = await fetch(COPYRIGHT_URL).then((response) => + const copyrightData = await fetch(COPYRIGHT_URL).then((response) => response.json() ); - return rawTileBoxes.normal.map((attr) => ({ - ...attr, - boxes: attr.boxes.map((box) => - L.latLngBounds(L.latLng(box[0], box[1]), L.latLng(box[2], box[3])) - ), - })); + const fields = copyrightData.resources.base.styles['lite.day']; + const tileBoxes = Object.values(_.pick(copyrightData.copyrights, fields)) + .flat() + .map((notice) => ({ + alt: notice.copyrightText, + label: notice.label, + maxLevel: notice.maxLevel, + minLevel: notice.minLevel, + boxes: notice.boundingBoxes.map((box) => + L.latLngBounds( + L.latLng(box.south, box.west), + L.latLng(box.north, box.east) + ) + ), + })); + return tileBoxes; } function cachedGetHereTileBoxes() {