i want to know how to name maps, put an id or something to find it later on openlayers, for example:
div id="map1">
div id="map2">
adition all code to set a map for fill it like:
map1 = new ol.Map({
id: 'Maps 1',
target: 'map1' });map2 = new ol.Map({
id: 'Maps 1',
target: 'map2' });
then i could find the div for map 1 or 2 with
mapDiv1 = document.getElementbyId('map1');
mapDiv2 = document.getElementbyId('map2');
but how can i Access the map in mapDiv1 o mapDiv2 ?
also i would like how to do this:
$.getJSON(theme.url, null, function (data)
but with pure JavaScript, that is couse data only exist inside this function, even if i asign it to a global variable it gets me null, also i don't use jquery or other frameworks just JavaScript.
Best Answer
Access can mean many things...
If by "access" you mean controlling the map: Normally you don't use the DOM elements for that. You control the map through your (openlayers) map-objects
map1
andmap2
.Examples:
If "access" ment you want to get the map as an image, then see this example: Export map.
Did you mean something else?