I'm trying to add a leaflet map to a document dynamically. However, I'm running into a little trouble. Here's what I've got so far:
var mapEle,layoutMap;mapEle = document.createElement('div');mapEle.setAttribute("id", "mapPage");mapEle.setAttribute("class", "page page-category");mapEle.innerHTML = 'test
';pages.append(mapEle);var bigMap = document.getElementById('bigMap');console.log("bigmap.id = " + bigMap.id);var largeMap = L.map(bigMap,{ attributionControl: false, zoomControl: false, touchZoom: false});largeMap.dragging.disable();largeMap.touchZoom.disable();largeMap.doubleClickZoom.disable();largeMap.scrollWheelZoom.disable();L.tileLayer(baseTilesURL).addTo(largeMap);However, I am not getting a map added to my document. I am planning on using this functionality tom loop over a data object of features and add a map to a report for each feature. Since I don't know how many features will be included in the report, I am unable to add the leaflet map to the html directly.
Any information will be greatly appreciated.
Best regards, Tyler
أكثر...
var mapEle,layoutMap;mapEle = document.createElement('div');mapEle.setAttribute("id", "mapPage");mapEle.setAttribute("class", "page page-category");mapEle.innerHTML = 'test
';pages.append(mapEle);var bigMap = document.getElementById('bigMap');console.log("bigmap.id = " + bigMap.id);var largeMap = L.map(bigMap,{ attributionControl: false, zoomControl: false, touchZoom: false});largeMap.dragging.disable();largeMap.touchZoom.disable();largeMap.doubleClickZoom.disable();largeMap.scrollWheelZoom.disable();L.tileLayer(baseTilesURL).addTo(largeMap);However, I am not getting a map added to my document. I am planning on using this functionality tom loop over a data object of features and add a map to a report for each feature. Since I don't know how many features will be included in the report, I am unable to add the leaflet map to the html directly.
Any information will be greatly appreciated.
Best regards, Tyler
أكثر...