mirror of
https://github.com/CIMEngine/map.git
synced 2024-11-21 18:36:22 +03:00
feat: get maps by id from list
This commit is contained in:
parent
e32a3e593b
commit
a48df5a470
1 changed files with 12 additions and 6 deletions
18
index.js
18
index.js
|
@ -41,12 +41,18 @@ window.onload = async () => {
|
|||
});
|
||||
|
||||
const projection = params.projection || "globe";
|
||||
const geoURL =
|
||||
params.geoURL ||
|
||||
"https://raw.githubusercontent.com/CIMEngine/WorldMap/main/map/geo.geojson";
|
||||
const countryInfoUrl =
|
||||
params.countryInfoUrl ||
|
||||
"https://raw.githubusercontent.com/CIMEngine/WorldMap/main/map/src/countries.json";
|
||||
const mapId = params.id || "worldMap";
|
||||
|
||||
let mapDataFromId = (
|
||||
await (
|
||||
await fetch(
|
||||
`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 =
|
||||
"pk.eyJ1IjoiYXJ0ZWdvc2VyIiwiYSI6ImNrcDViN3BhcDAwbW0ydnBnOXZ0ZzFreXUifQ.FIVtaBNr9dr_TIw672Zqdw";
|
||||
|
|
Loading…
Add table
Reference in a new issue