feat: get maps by id from list

This commit is contained in:
Artemy 2023-06-11 09:39:17 +03:00
parent e32a3e593b
commit a48df5a470

View file

@ -41,12 +41,18 @@ window.onload = async () => {
}); });
const projection = params.projection || "globe"; const projection = params.projection || "globe";
const geoURL = const mapId = params.id || "worldMap";
params.geoURL ||
"https://raw.githubusercontent.com/CIMEngine/WorldMap/main/map/geo.geojson"; let mapDataFromId = (
const countryInfoUrl = await (
params.countryInfoUrl || await fetch(
"https://raw.githubusercontent.com/CIMEngine/WorldMap/main/map/src/countries.json"; `https://raw.githubusercontent.com/CIMEngine/MapList/main/index.json`
)
).json()
)[mapId];
const geoURL = params.geoURL || mapDataFromId.geoURL;
const countryInfoUrl = params.countryInfoURL || mapDataFromId.countryInfoURL;
mapboxgl.accessToken = mapboxgl.accessToken =
"pk.eyJ1IjoiYXJ0ZWdvc2VyIiwiYSI6ImNrcDViN3BhcDAwbW0ydnBnOXZ0ZzFreXUifQ.FIVtaBNr9dr_TIw672Zqdw"; "pk.eyJ1IjoiYXJ0ZWdvc2VyIiwiYSI6ImNrcDViN3BhcDAwbW0ydnBnOXZ0ZzFreXUifQ.FIVtaBNr9dr_TIw672Zqdw";