Mapbox style to separate overlapping lines
Asked Answered
S

1

6

Given two linestrings that occupy the same space, is it possible to define a style such that the lines are offset from each other and are rendered side-by-side?

A colleague says he can half remember that this functionality is available in the style spec, but I have not been able to find reference to it. Is it possible?

Succubus answered 17/9, 2018 at 5:45 Comment(0)
M
8

The property you are looking for is "Line-Offset".

From documentation (paint-line-line-offset as of 2018-09-17) :

line-offset (Paint property) Optional number. Units in pixels. Defaults to 0. Transitionable.

The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.

Macdougall answered 17/9, 2018 at 11:6 Comment(2)
When I first looked over this property, I didn't think it suited my needs. You prompted me to take another look at it, and it is actually what I need. CheersSuccubus
can this be done automatically by the mapbox engine? without having to manually offset a line, but instead it detects overlaps and offsets them for youSwob

© 2022 - 2024 — McMap. All rights reserved.