【发布时间】:2017-12-02 15:49:48
【问题描述】:
使用 QGIS,我已将多边形图层导出为 geojson,我想将其与传单一起发布。这就是 geojson 的样子 [由于 SO 字符限制而被排除]: https://gist.github.com/t-book/88806d12d7f05024b147715be82e6844
这是我尝试过的:
将 geojson 包装为 var:
var states = [{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::31468" } },
"features": [
{ "type": "Feature", "properties": ...
}];
作为新层添加:
L.geoJSON(states, {
style: function(feature) {
switch (feature.properties.party) {
case 'Euerbach': return {color: "#ff0000"};
case 'Werneck': return {color: "#0000ff"};
}
}
}).addTo(map);
不幸的是,没有渲染任何内容。如何正确将此 geojson featureCollection 添加到我的地图?
【问题讨论】:
标签: leaflet geojson map-projections