folium 编写的HTML文件空白,Python创建的简单HTML / Javascript页面显示为空白

我只是关注这个关于Folium的tutorial - 一个制作网络地图的Python库。该教程指出,只有以下三行Python代码才能创建Web地图:

import folium

map_osm = folium.Map(location=[45.5236, -122.6750])

map_osm.create_map(path='osm.html')根据教程,This是osm.html的外观。

但是,osm.html文件在我的浏览器上显示为空白网页。

这是我的osm.html文件的源代码,如果有帮助的话:

html, body {

width: 100%;

height: 100%;

margin: 0;

padding: 0;

}

#map {

position:absolute;

top:0;

bottom:0;

right:0;

left:0;

}

var base_tile = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {

maxZoom: 18,

minZoom: 1,

attribution: 'Map data (c) OpenStreetMap contributors'

});

var baseLayer = {

"Base Layer": base_tile

};

/*

addition of the wms layers

*/

/*

addition of the tile layers

*/

/*

list of layers to be added

*/

var layer_list = {

};

/*

Bounding box.

*/

var southWest = L.latLng(-90, -180),

northEast = L.latLng(90, 180),

bounds = L.latLngBounds(southWest, northEast);

/*

Creates the map and adds the selected layers

*/

var map = L.map('folium_62f4bc18e7a1444b908b0413335a38b1', {

center:[20, 40],

zoom: 10,

maxBounds: bounds,

layers: [base_tile]

});

L.control.layers(baseLayer, layer_list).addTo(map);

//cluster group

var clusteredmarkers = L.markerClusterGroup();

//section for adding clustered markers

//add the clustered markers to the group anyway

map.addLayer(clusteredmarkers);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值