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

Add options for toggling buildings, traffic, POIs in Mapbox Streets–sourced styles #8071

Closed
1ec5 opened this issue Feb 15, 2017 · 6 comments
Assignees
Labels
archived Archived because of inactivity feature Google Maps parity For feature parity with the Google Maps SDK for Android or iOS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS MapKit parity For feature parity with MapKit on iOS or macOS runtime styling

Comments

@1ec5
Copy link
Contributor

1ec5 commented Feb 15, 2017

MGLStyle should have showsBuildings, showsTraffic, and showsPointsOfInterest properties that toggle the visibility of relevant layers in any style that uses the Mapbox Streets and/or Mapbox Traffic sources. These properties would help us achieve parity with the similarly named MKMapView properties in MapKit and the GMSMapView.buildingsEnabled and GMSMapView.trafficEnabled properties in the Google Maps SDK for iOS.

  • showsBuildings would toggle the visibility of any MGLFillStyleLayer or MGLFillExtrusionStyleLayer whose source’s URL is mapbox.mapbox-streets-v7 and whose sourceLayerIdentifier is building.
  • showsTraffic would toggle the visibility of any MGLLineStyleLayer whose source’s URL is mapbox://mapbox.mapbox-traffic-v1.
  • showsPointsOfInterest would toggle the visibility of any MGLSymbolStyleLayer whose source’s URL is mapbox.mapbox-streets-v7 and whose sourceLayerIdentifier is poi_label.

We should also add corresponding IBInspectable properties to the MGLMapView(IBAdditions) category for parity with MapKit:

inspectables

This feature would obviate mapbox/ios-sdk-examples#64.

/cc @bsudekum @frederoni @pveugen

@1ec5 1ec5 added feature Google Maps parity For feature parity with the Google Maps SDK for Android or iOS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS MapKit parity For feature parity with MapKit on iOS or macOS runtime styling labels Feb 15, 2017
@1ec5
Copy link
Contributor Author

1ec5 commented Feb 15, 2017

One thorny issue is what the getter’s default value should be and what the getter and setter should do in the event of a mixed state (some relevant layers shown, some hidden).

@1ec5
Copy link
Contributor Author

1ec5 commented Apr 18, 2018

#11726 proposes a similar inspectable for label localization.

@1ec5
Copy link
Contributor Author

1ec5 commented Apr 18, 2018

One thorny issue is what the getter’s default value should be and what the getter and setter should do in the event of a mixed state (some relevant layers shown, some hidden).

For the inspectable specifically, Interface Builder represents a Boolean property as a three-way option, with “Default Value” corresponding to the natural state where the setter is never called. So the question of a default value is only thorny for the public property but not the inspectable.

The public property could have a non-Boolean type, like MapKit’s three-way MKFeatureVisibility enumeration.

@fabian-guerra
Copy link
Contributor

@1ec5 the traffic style is enabled by default. If someone uses:
mapbox://styles/mapbox/traffic-day-v2 will get the the traffic status turned on.

I'm not sure this IBInspectable would be necessary at all. Unless when setting the property on I reload with the traffic style, which it may be problematic for developers.

Or maybe just left it as a convenience method for navigation.

@1ec5
Copy link
Contributor Author

1ec5 commented Jul 10, 2018

It’s important to distinguish between the Traffic source and the Traffic Day/Night styles. As seen in the Traffic plugin, any style can have traffic congestion lines powered by the Traffic source; no reloading is required.

We could treat these inspectables as a way to force certain things on or off. When an inspectable is in its default state, we would leave the style untouched, so the Traffic Day style would have traffic by default, but the Streets style would not. On the other hand, when the inspectable is on, both styles would have traffic layers.

That said, some of these options, including traffic, could be problematic because we don’t necessarily know what would look good atop an arbitrary style. So we could scope down this feature even further: the inspectables would only hide certain layers but not create any layers on its own.

@stale stale bot added the archived Archived because of inactivity label Jan 6, 2019
@stale
Copy link

stale bot commented Jan 6, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Jan 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity feature Google Maps parity For feature parity with the Google Maps SDK for Android or iOS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS MapKit parity For feature parity with MapKit on iOS or macOS runtime styling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants