【发布时间】:2015-08-11 05:19:10
【问题描述】:
有人能解释一下为什么这个传单代码适用于可视化纽约州的 GeoJson 数据,但我无法绘制纽约市的数据。我对 QGIS 中的文件使用了相同的导出首选项。
我使用了以下链接中的数据:
纽约市 http://www.nyc.gov/html/dcp/html/bytes/districts_download_metadata.shtml
纽约州 http://cugir.mannlib.cornell.edu/bucketinfo.jsp?id=7865
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link rel="stylesheet" href="style_blank.css" />
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="sdfgsdgdfgfdsgd.js"></script>
<div id="map"></div>
<script>
var map = L.map('map',{
center: [5,28],
zoom: 3,
minZoom: 2,
maxZoom: 18
});
L.geoJson(data, {
style: function (feature) {
return {color: feature.properties.color};
},
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.description);
}
}).addTo(map);
</script>
</body>
</html>
【问题讨论】:
-
你能把这个放到演示网站上吗?或者至少给我们看看geojson?