Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper support for non-Mapbox styles #2

Open
ianthetechie opened this issue Feb 10, 2023 · 1 comment
Open

Add proper support for non-Mapbox styles #2

ianthetechie opened this issue Feb 10, 2023 · 1 comment

Comments

@ianthetechie
Copy link
Contributor

Motivation

This is MapLibre navigation, not Mapbox Navigation anymore. As such, I propose that we support, at a minimum, OpenMapTiles-derived tiles, but a general solution seems quite possible. Right now there are numerous points at which Mapbox styles are hord-coded, and we should generally avoid this, or any similar sort of dependence on a single tile provider.

Design

It a minimum, we will need to touch MGLVectorTileSource.swift, NavigationMapView.swift, and RouteMapViewController.swift, as these all have a hard-coded dependency on the Mapbox Streets style. My understanding is that these are primarily for picking up road labels, but they may be used for more.

MGLVectorTileSource is the root of the problem, since it is so mapbox-specific. We essentially have two options: add more variants (ex: OMT), or find a different, more general solution for picking out the correct source and layer.

Beyond this, I am unfortunately not able to propose a design off the top of my head. I would welcome input from others with more familiarity.

Mock-Up

N/A

Concepts

TBD

Implementation

TBD if we go for the more general option. Fairly straightforward to add a case for isOpenMapTiles or something, though I think we would probably have to make a heuristic guess at whether the style truly is OpenMapTiles-compatible. Perhaps hasTransportationName would be a more useful approach?

Feedback welcome; all of my specific suggestions are secondary to the overall goal of properly supporting non-Mapbox styles. I'm happy to contribute code after some discussion with the community.

@michaelkirk
Copy link
Collaborator

Currently there's no way (as far as I can tell) to specify a styleURL for NavigationViewController.

I'm wondering if that's the same underlying issue as here, or if I should open a new issue.

NavigationViewController gets its MLNMapView via (self.mapViewController.view as NavigationView).mapView

class NavigationView: UIView {
  ...
  lazy var mapView: NavigationMapView = { // Subclass of MLNMapView
       let map: NavigationMapView = .forAutoLayout(frame: self.bounds) // not given a styleURL
       map.delegate = self.delegate
       map.navigationMapDelegate = self.delegate
       map.courseTrackingDelegate = self.delegate
       map.showsUserLocation = true
       return map
  }()
}

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

No branches or pull requests

2 participants