tilemill icon indicating copy to clipboard operation
tilemill copied to clipboard

Feature request: stroke mask

Open jeffreyameyer opened this issue 13 years ago • 5 comments

For border highlighting effects - either interior (http://goo.gl/maps/8sVKh) or exterior (shoreline), it would be great if there were a way to mask strokes from one "edge" of the stroke or the other.

line-offset doesn't work well, as it doesn't fill to the target border. ST_buffer requires all sorts of processing, different layers for every zoom level, and carto pyrotechnics.

Stroke mask explanation: http://imgur.com/QMzfg Stroke mask example: http://imgur.com/GUHuS

I can guess that this might be a pain to implement, but it seems like it might be fairly useful.

jeffreyameyer avatar Oct 02 '12 17:10 jeffreyameyer

Yes, it would be nice if tint-bands were easier. And yes, the only way I've seen this done (by @ajashton ) was using a negative ST_Buffer on a polygon, then rendering that. line-offset is designed for offsetting lines and is not/cannot be polygon aware. So, the best hack I can think off is to use a negative line offset, make it very thick, and then mask out the overflow using a polygon. With complex shoreline boundaries line-offset will produce enough artifacts that this may not look good (unless your line is way thick) (at least until we add support in Mapnik for on-the-fly simplification), but for afghanistan I can get a pretty good look:

springmeyer avatar Oct 02 '12 18:10 springmeyer

Ah! ... actually... the '!=' goes a long way to helping out... duh!

That said, I think the example above gets trickier when:

(a) each bordering country has a different color that is assigned with a long (e.g. 1 for every country, like Geography Class) list of lookups inside the [NAME!='Afghanistan'] section (for example, if somewhere in that contained list is another [NAME='Afghanistan'] {polygon-fill: @AfghanColor; } For example, I'm creating (or later... interactively) focused maps for every country. When that country is selected, either by a variable @FOCUS = 'Afghanistan';, or by some interaction, I'd like to be able to control this color tint programmatically or from a single variable setting.

and

(b) when you aren't landlocked. ; )

jeffreyameyer avatar Oct 02 '12 19:10 jeffreyameyer

@tmcw @springmeyer Is there any progress on tint bands? I work at nat geo maps and it's a barrier of many of the projects we do here and wish to do on the web. Tint bands are one of our requirements on most of the projects for print in which any attempt to migrate to the web is a no go because of it. I've been able to sort of hack it together but only to find tile boundary edges get the same effect (checkerboard lines) - any idea of a better way to go about it in Classic?

A simpler solution would be align inside, outside, or middle for a line but I haven't seen that as a parameter for lines.

These were done using a similar technique to geography class;

screen shot 2016-03-16 at 3 25 35 pm

screen shot 2016-03-16 at 3 12 14 pm

jrbowen avatar Mar 18 '16 15:03 jrbowen

@jbowen24 - If you are using Mapbox Studio Classic to avoid those lines you need to buffer the source data: https://www.mapbox.com/help/source-manual/#buffers

See also as background in general: https://www.mapbox.com/blog/customizing-geography-class/, https://github.com/springmeyer/tilemill-examples/blob/master/tint-bands/style.mss, https://github.com/springmeyer/tilemill-examples/tree/master/single-tint-band

springmeyer avatar Mar 18 '16 18:03 springmeyer

@springmeyer, ahh yes! super helpful thanks!

jrbowen avatar Mar 21 '16 19:03 jrbowen