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

Removing Mapbox Road Hardcoding #43

Merged
merged 4 commits into from
May 31, 2024

Conversation

hactar
Copy link
Collaborator

@hactar hactar commented May 18, 2024

During setting up, maplibre-navigation-ios checks if the mapbox street source is part of the map style. If it is not, it adds the source and creates a new layer. This results in the console throwing network errors as "mapbox://mapbox.mapbox-streets-v7" is not a valid URL in a non mapbox app.

This PR removes this hardcoded check - I guess this made sense when this was only used with mapbox services, but now that people use this with their non mapbox styles, this "hotfixing of the mapstyle" makes no sense.

@michaelkirk
Copy link
Collaborator

I agree that it doesn't make sense to link to a mapbox url that the app doesn't even know how to handle.

Instead of removing this logic, is there a possibility of a maplibre hosted style? In theory it seems kind of nice that things could "just work" for library users, but maybe the project isn't interested in the amount of hosting that would imply.

@michaelkirk
Copy link
Collaborator

Instead of removing this logic, is there a possibility of a maplibre hosted style?

I thought about this more while working on #45, and personally concluded that injecting default styles in the middle of the code base is probably not the right approach, so I take back my comment.

}.filter(\.isMapboxStreets)

// Add Mapbox Streets if the map does not already have it
if streetsSources.isEmpty {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect that there are valid reasons for the person to be in this state where they would want to silently proceed without error?

If not, though we don't have a reasonable default layer to fall back to like mapbox did, could we instead help the user out with an assertionFailure or a log message here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see a way or reason for this. I would assume Mapbox added this because they were getting support emails from users saying "my custom style is not showing roads during navigation", and a common reason was that the users had removed or restyled the road layer to be incompatible with the styling of maplibre navigation.

If I'm a german developer and name my sources and layers for roads "strassennetz" things will work perfectly fine - and yet maplibre would now throw a warning that it can't find a road layer. So unless we want to enforce a certain naming scheme for things in the style.json for maplibre navigation, I don't think emitting warnings would be helpful.

@boldtrn
Copy link
Collaborator

boldtrn commented May 24, 2024

Good catch to remove this code @hactar 👍. While I fully agree that we should remove this Mapbox specific logic here. There is similar usage here as well:

@objc public func localizeLabels() {

I am currently wondering if we should make this configurable or just completely remove?

Copy link
Collaborator

@boldtrn boldtrn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. Could you add a Changelog entry for this change?

@hactar
Copy link
Collaborator Author

hactar commented May 25, 2024

Good catch to remove this code @hactar 👍. While I fully agree that we should remove this Mapbox specific logic here. There is similar usage here as well:

@objc public func localizeLabels() {

I am currently wondering if we should make this configurable or just completely remove?

The one that I found should just be plain removed I think, but the one that you found is an interesting one - it tries to modify the street labels to the countries locale they are in so that they match the signs people might see on streets. That could be a useful feature, but we would need to change this so that we can provide maplibre navigation with the layers that contain the road networks, instead of it trying to find the "mapbox road network". And that layer also needs to support "mul" locale for this to work I guess... So that one should be investigated, but I suggest outside this ticket.

@hactar
Copy link
Collaborator Author

hactar commented May 25, 2024

Thanks for working on this. Could you add a Changelog entry for this change?

Done.

Copy link
Collaborator

@boldtrn boldtrn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, your change looks good to me. Would you mind resolving the conflicts? Feel free to merge afterwards 👍

@hactar
Copy link
Collaborator Author

hactar commented May 29, 2024

@boldtrn the conflict has been resolved, I have no write permissions so you or someone else will have to hit the button ☺️

@boldtrn boldtrn merged commit b4fc365 into maplibre:main May 31, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants