为什么我的笔划线 shiny/still 出现在我的 Leaflet 地图中?
Why are my stroke lines shiny/still showing up in my Leaflet map?
这是我的地图的原始版本:https://cdn.rawgit.com/elbertwang3/asiansintheus/bf7ea219/index.html
在第一张图中,我已经将笔划线的不透明度和粗细设置为 0,但笔划线仍然显示!它们并不完全在那里,但在某些十字路口 shiny/half 那里。我可以摆脱它们还是可以以某种方式使它们统一?这让 choropleth 看起来真的很奇怪。作为参考,我使用了 geojson 来呈现县边界,所以我不确定这是 Leaflet 问题还是 geojson 问题。
这是我设计地图样式的部分:
var getColor = chroma.scale(['#451A53','#40968B','#FDE733']).domain([0,110000])
function style(feature) {
return {
fillColor: getColor(feature.properties['2009']),
color: 'white',
weight: 0,
opacity: 0,
fillOpacity: 1
};
}
L.geoJson(countyData, {style: style}).addTo(countymap);
RTFM。让我引用 Leaflet API documentation,关于从 L.Path
继承的 polygon/polyline 选项的部分:
stroke
Boolean
true
Whether to draw stroke along the path. Set it to false
to disable borders on polygons or circles.
因此,您应该设置一个值为 false
的 stroke
选项。这将告诉矢量渲染器(SVG 或 Canvas)明确跳过笔划。
但是,您的情况可能是 slivers due to polygon simplification. That directly depends on the smoothfactor
option 折线和多边形之一。请注意,这会影响性能。
这是我的地图的原始版本:https://cdn.rawgit.com/elbertwang3/asiansintheus/bf7ea219/index.html
在第一张图中,我已经将笔划线的不透明度和粗细设置为 0,但笔划线仍然显示!它们并不完全在那里,但在某些十字路口 shiny/half 那里。我可以摆脱它们还是可以以某种方式使它们统一?这让 choropleth 看起来真的很奇怪。作为参考,我使用了 geojson 来呈现县边界,所以我不确定这是 Leaflet 问题还是 geojson 问题。
这是我设计地图样式的部分:
var getColor = chroma.scale(['#451A53','#40968B','#FDE733']).domain([0,110000])
function style(feature) {
return {
fillColor: getColor(feature.properties['2009']),
color: 'white',
weight: 0,
opacity: 0,
fillOpacity: 1
};
}
L.geoJson(countyData, {style: style}).addTo(countymap);
RTFM。让我引用 Leaflet API documentation,关于从 L.Path
继承的 polygon/polyline 选项的部分:
stroke
Boolean
true
Whether to draw stroke along the path. Set it tofalse
to disable borders on polygons or circles.
因此,您应该设置一个值为 false
的 stroke
选项。这将告诉矢量渲染器(SVG 或 Canvas)明确跳过笔划。
但是,您的情况可能是 slivers due to polygon simplification. That directly depends on the smoothfactor
option 折线和多边形之一。请注意,这会影响性能。