上海疫情地图查询 (上海疫情地图实时更新)

上海夜店 05-14 阅读:33 评论:0

以下地图实时更新上海市的疫情信息,包括确诊病例、无症状感染者和疑似病例的分布情况。

script.js javascript // 创建地图 var map = L.map('map').setView([31.2304, 121.4737], 10);// 添加图层 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution:'© OpenStreetMap contributors' }).addTo(map);// 加载数据 $.getJSON("data.json", function(data) {// 遍历数据for (var i = 0; i < data.features.length; i++) {var feature = data.features[i];// 创建标记var marker = L.marker([feature.geometry.coordinates[1], feature.geometry.coordinates[0]]);// 设置标记的弹出信息marker.bindPopup("

" + feature.properties.name + "

上海疫情地图查询 (上海疫情地图实时更新)

" + feature.properties.type + "

");// 添加标记到地图marker.addTo(map);} });data.json json {"type": "FeatureCollection","features": [{"type": "Feature","geometry": {"type": "Point","coordinates": [121.4737, 31.2304]},"properties": {"name": "浦东新区","type": "确诊病例"}},{"type": "Feature","geometry": {"type": "Point","coordinates": [121.5113, 31.2732]},"properties": {"name": "静安区","type": "无症状感染者"}},{"type": "Feature","geometry": {"type": "Point","coordinates": [121.4851, 31.1536]},"properties": {"name": "闵行区","type": "疑似病例"}}] }style.css css map {width: 100%;height: 500px; }
版权声明

本文仅代表作者观点,不代表上海桑拿立场。
本文系作者授权发表,未经许可,不得转载。

分享:

扫一扫在手机阅读、分享本文