SVG中相邻路径上的虚线/虚线笔触 [英] Overlapping Dashed / Dotted Strokes on Adjacent Paths in SVG

查看:317
本文介绍了SVG中相邻路径上的虚线/虚线笔触的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在绘制共享边界的多个县的地图.每个县都是自己的封闭路径,因此相邻县的边界彼此重叠.

I'm building a map of several counties that share borders. Each county is it's own enclosed path, and therefore the borders of adjacent counties are stacked over one another.

我想给每个县一个虚线.但是,当应用时,由于每个县的虚线边框重叠,相交的边框看起来很难看,从而形成不均匀的虚线外观.

I'd like to give each county a dashed stroke. However, when applied, the intersecting borders look ugly as the dashed borders of each county overlap, creating an uneven dash appearance.

我的用户将通过在县边界内的区域上移动鼠标来选择县,因此(我认为)使得有必要为每个县创建一条封闭的路径.

My users will be selecting counties by mousing over the area within the county borders, thus (I believe) making it necessary to create an enclosed path for each county.

解决方案?

推荐答案

我最终以不同于任何建议的方式解决了这个问题.我发布了另一个,更多具体问题在这里. (请参阅我的答案)

I ended up solving this differently than any of the suggestions. I posted another, more specific question here. (See my answer)

完成另一个问题中概述的步骤后,我将shapefile转换回geojson并将其加载到地图中.我没有删除包含整个多边形的geojson,而是只是关闭了该图层上的边框样式.然后,我将相同的图层样式应用于已分解的geojson,这次是用虚线绘制.

Once I completed the steps I outlined in the other question, I converted the shapefile back to geojson and loaded it into my map. I didn't remove the geojson that included the whole polygons, but simply turned off the border style on that layer. I then applied the same layer stylings to the dissolved geojson, and this time with a dashed stroke.

结果图像在这里.

这篇关于SVG中相邻路径上的虚线/虚线笔触的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆