mapbox / mapbox/mapbox-maps-ios

[Question] Is it possible to draw buffer around layer?

Open
#1,838 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle: question
Dominant language
Swift
Stars
601
Forks
196
PR merge metrics
No merged PRs in 30d

Description

Hello.
I am using Xamarin wrapper for your library, but my question is related to your SDK.

In the code below you can see that I am trying to add one more style for the layer, which should show a buffer around my polygon with a gap 50 (I hope it's meters).
But when I zoom in/out the gap changes.

Maybe you can propose another way to draw a dashed line/buffer around my polygon?

var lineLayer = new MGLLineStyleLayer(layerId + LAYER_DEVIATION_THRESHOLD_SUFFIX, source)
{
LineDashPattern = NSExpression.FromFormat(@"{2, 1.5}"),
LineWidth = NSExpression.FromConstant(FromObject(2.0f)),
LineColor = NSExpression.FromConstant(layerFillColor),
LineGapWidth = NSExpression.FromConstant(FromObject(50.0f))
};

Also how to do only the Outer gap line?
![IMG_0013](https://user-images.githubusercontent.com/110451358/211299044-81bb3768-8722-43a2-8ba6-59f573151e24.jpg)
![IMG_0012](https://user-images.githubusercontent.com/110451358/211299053-b293c008-c377-4964-b3f9-106e2badb718.jpg)

Best regards
Oleksandr

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MGLLineStyleLayer configuration and its LineGapWidth and LineDashPattern properties shown in the issue. Determine whether the SDK supports a scale-independent buffer or an outer-only gap, then confirm the expected behavior with a minimal map example; done means a supported approach or limitation is clearly identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.