When plotting adjacent polygons, for instance, the states of a country, the lines are usually thicker/darker in the border between two polygons, compared to a polygon on the edge of the map. That happens because that border is drawn twice, once for each polygon. This is even a bigger problem when we want to use semitransparent or dashed lines.

The images below illustrate the problem.

map with dotted lines

Image 1 The dashes from one polygon don't fit the dashes from the other polygon, resulting in different sized dashes, or no visible dashes at all.

map with semitransparent lines

Image 2 Semitransparent lines get darker when drawn over each other.

This problem arises wherever we try to draw maps, be it a GIS software (such as QGis), R plots or HTML5 canvas.

Since this is such a common problem, I wonder if there's a clever solution already worked out, besides the painting of simple black lines (which actually won't solve the problem, because in most devices nowadays two identical lines drawn over each other create a thicker line).

  • for shared boundaries, you can use a virtual layer gis.stackexchange.com/questions/291637/… – JGH Jul 31 '19 at 15:44
  • I'm going to post a comment rather than an answer because I'm not sure I'm correct: The two problems you see (dashes as well as semitransparent lines) may be due to the data source. For example (If I recall), each FGDB feature class polygon is stored with its own separate boundary, which results in "double-digitizing" along shared borders. When displayed, the dashes from each of the two borders don't always line up, creating a solid-line effect. With solid lines, the display is an additive effect. Shapefiles aren't stored "double-digitized", thus no problem. Not sure about Geopackages. – Stu Smith Jul 31 '19 at 16:07
  • I remember facing this dashed-line problem when FGDB first came out. The ESRI Tech Support "workaround" was to 1) convert the FGDB polygon layer to a shapefile line layer, 2) display the FGDB polygons without outlines, 3) display the shapefile layer as a dashed line on top of the FGDB polygons, thus adding the polygon outlines. – Stu Smith Jul 31 '19 at 16:32
  • @JGH This may solve the problem in QGIS, but not in R or HTML5. – Rodrigo Jul 31 '19 at 18:24
  • @StuSmith I don't get what you're saying. I'm using shapefiles in all 3 mentioned applications, and each polygon (state) has it's own border, which causes the problem when the same boundary is drawn twice. I have no clue about what FGDB and Geopackages mean, anyway I use shapefiles everywhere. Your workaround seems sensible, and maybe the only solution... – Rodrigo Jul 31 '19 at 18:30

In QGIS, you can set the opacity at the layer rendering level, which will ignore self-overlays by default

enter image description here

| improve this answer | |
  • This may solve the problem in QGIS, but not in R or HTML5. I was thinking more in terms of changing double-line boundaries with single-line boundaries -- this would solve the problem everywhere. – Rodrigo Jul 31 '19 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.