OSDP Integration | |
Main |
Demonstration of Open Science Data Portal Integration |
document.getElementById('Map1').remove();
if (!document.getElementById('Map1')) { const newDiv = document.createElement('div'); const id = document.createAttribute('id'); id.value = 'Map1'; newDiv.setAttributeNode(id); const dataLang = document.createAttribute('data-lang'); dataLang.value = lang; newDiv.setAttributeNode(dataLang); document.getElementById('mapSection').appendChild(newDiv); }
return new Promise (resolve => { removeMap('Map1') .then(() => { cgpv.api.createMapFromConfig('Map1', JSON.stringify(mapConfig), 800) .then(() => { resolve(); }); }); }); function removeMap(map) { return new Promise(resolve => { if (cgpv.api.maps[map]) { cgpv.api.maps[map].remove(false) .then(() => { resolve(); }); } else { resolve(); } }); }
mapConfig = cgpv.api.maps.Map1.createMapConfigFromMapState();
lang = lang === 'fr' ? 'en' : 'fr'; const mapDiv = document.getElementById('Map1'); if (mapDiv) { mapDiv.setAttribute('data-lang', lang); cgpv.api.maps.Map1.reloadWithCurrentState(); }
if (document.getElementById('Map1')) { const layerUuids = document.getElementById('layerUuids').value; const uuidList = layerUuids.split('\n').join(',').split(','); addLayers(uuidList); } function addLayers(layers) { layers.forEach((layer) => { cgpv.api.maps.Map1.layer.addGeoviewLayerByGeoCoreUUID(layer); }); }
cgpv.api.maps.Map1.layer.addGeoviewLayerByGeoCoreUUID(uuid, customListOfLayerEntries);