Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

How to draw a dashed line on iOS app? #6033

Closed
chatwyn opened this issue Aug 16, 2016 · 8 comments
Closed

How to draw a dashed line on iOS app? #6033

chatwyn opened this issue Aug 16, 2016 · 8 comments

Comments

@chatwyn
Copy link

chatwyn commented Aug 16, 2016

How to draw a dashed line on iOS app ?

@chatwyn chatwyn changed the title How to draw a dashed line on IOS app ? How to draw a dashed line on iOS app? Aug 16, 2016
@incanus
Copy link
Contributor

incanus commented Aug 16, 2016

Hi @chatwyn. Please send usage questions in to https://www.mapbox.com/help/ per the contributing guidelines.

@incanus incanus closed this as completed Aug 16, 2016
@chatwyn
Copy link
Author

chatwyn commented Aug 17, 2016

I have't find setting lind dashed in the MGLMapViewDelegate . I only find color alpha and lineWidth.

@1ec5
Copy link
Contributor

1ec5 commented Aug 26, 2016

#1734 tracks adding a dedicated API for this. In the meantime, in iOS SDK v3.4.0 (currently in alpha testing):

  1. Create an MGLGeoJSONSource containing the line data.
  2. Create an MGLLineStyleLayer based on that source, and set its lineDasharray property to something like @[@1, @2].
  3. Add the style layer to the map view.

@chatwyn
Copy link
Author

chatwyn commented Aug 28, 2016

thanks

@eimantas
Copy link
Contributor

@1ec5 I couldn't find any references to MGLGeoJSONSource. Is the described approach still relevant?

@jmkiley
Copy link
Contributor

jmkiley commented Mar 14, 2017

You may find this example helpful: https://www.mapbox.com/ios-sdk/examples/runtime-add-line/

@1ec5
Copy link
Contributor

1ec5 commented Mar 14, 2017

MGLGeoJSONSource was renamed MGLShapeSource in #7334 because developers usually interact with it in conjunction with MGLShapes rather than GeoJSON source.

@songyuyang0918
Copy link

songyuyang0918 commented May 26, 2020

@1ec5 Hello! Now, if you want to make the fillLayer edges into dotted lines, can you only add another layer of lineLayer instead of making changes on the fillLayer?
If so, I will do so, but I wonder if there is an expression in lineDashPattern that allows me to match attributes in Source to show dashed lines.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants