Dmi*_*try 7 javascript openlayers leaflet
我是leaflet.js的新手,我想弄清楚如何将同一组选项和图层分配给不同的HTML容器,而不是每次都要删除并添加一个新的?
我曾经处理Open层2.13而且我有map.render(div); 每次我想将地图设置为另一个div时选项.有没有类似的解决方案?非常感谢!
YaF*_*red 13
你可以,但你必须复制图层
// add an OpenStreetMap tile layer
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// add the same OpenStreetMap tile layer to the second map
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map2);
Run Code Online (Sandbox Code Playgroud)
http://jsfiddle.net/FranceImage/aj44r7v2/
| 归档时间: |
|
| 查看次数: |
10745 次 |
| 最近记录: |