mirror of
https://github.com/CIMEngine/map.git
synced 2024-11-25 04:06:20 +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 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";
|
||||||
|
|
Loading…
Add table
Reference in a new issue