How to keep dashed state borders from appearing as solid lines?

When using -N2/0.5p,grey57,- the borders between some US states show up solid instead of dashed.

I assume it has to do with the states being closed polygons with different length and the position of the gaps therefore not always matching the position of the gaps of the neighbouring polygon.

Is there an option or a neat trick to have them show up as dashed regardless of line overlap?

Some code to play with:

gmt begin neutral_bg_map
	gmt set MAP_FRAME_TYPE PLAIN FORMAT_GEO_MAP ddd:mm:ssF PS_LINE_JOIN round
	gmt coast -R-130/-70/24/52 -Jl-100/35/33/45/1:50000000 -Ba -Dl \
		-N1/1p,grey43 -N2/0.5p,grey57,- \
		-I1/grey88 -W0.5p,grey43 -Ggrey98 -Sgrey88 -A500
gmt end show

Hm, tricky. You are right the neighbouring polygons overlap and have different starting points for dashes and they form a solid line. Tricks that come to mind would be lay down just land and solid borders, then draw dense but fat white grid lines to make them dashed, then do ocean and others things?

Mh that’s an interesting approach. Thank you for sharing.

My idea is to export all those polygons, find the borders with other polygons (currently I expect some kind of magic to happen here), delete doubled points and as a result have every border segment as a single ploy line. Plot them as I fancy without worrying about overlap. Feasibility? … smells a lot like manual labor.

I haven’t done this but I think it doesn’t:

  1. Take the first polygon (say the state of Washington) and find all other polygons this state intersects with. The intersections will be (by definition) the boundary lines (or single points), save these (points can be omitted).
  2. Find all possible intersections between these other polygons (boundary lines; points can be omitted), save these too.
  3. Join the first polygon and the intersecting ones.
  4. Repeat 1-3 now starting with the joined bigger polygon until there’s no polygons left.

The only problem (for the likes of me) would be how to code this using e.g. Spatialite (or python, I don’t even remember what is the name of python tools for spatial analysis, shame of me!)