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

MapLibre support #1571

Merged
merged 1 commit into from
Oct 20, 2021
Merged

MapLibre support #1571

merged 1 commit into from
Oct 20, 2021

Conversation

mfazekas
Copy link
Contributor

Description

Fixes #1472

MapLibre 5.12 support

Note the following should be added to Podfile for MapLibre 5.12 support.

$RNMGL_USE_MAPLIBRE = true

@ferdicus
Copy link
Member

thanks @mfazekas 🙇🏿
Will test this coming friday 👍🏿

Copy link
Member

@ferdicus ferdicus left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for this 👍🏿

tested with styleUrl pointed to mapbox ('mapbox://styles/mapbox/dark-v10') with a valid accesstoken and got these errors.
Not sure if related though 😕
Maybe just logger spam - posting nevertheless

 ERROR  Mapbox error Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00> {"filePath": "-[MGLNetworkConfiguration errorLog:]", "level": "error", "line": 129, "message": "Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00>"}
 ERROR  Mapbox error [event]:Setup [code]:-1 [message]:loading style failed: unsupported URL {"filePath": "virtual bool mbgl::MGLCoreLoggingObserver::onRecord(mbgl::EventSeverity, mbgl::Event, int64_t, const std::string &)", "level": "error", "line": 30, "message": "[event]:Setup [code]:-1 [message]:loading style failed: unsupported URL"}
 ERROR  Mapbox error Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00> {"filePath": "-[MGLNetworkConfiguration errorLog:]", "level": "error", "line": 129, "message": "Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00>"}
 ERROR  Mapbox error [event]:Style [code]:-1 [message]:Failed to load source composite: unsupported URL {"filePath": "virtual bool mbgl::MGLCoreLoggingObserver::onRecord(mbgl::EventSeverity, mbgl::Event, int64_t, const std::string &)", "level": "error", "line": 30, "message": "[event]:Style [code]:-1 [message]:Failed to load source composite: unsupported URL"}

Map still showed and worked:

I guess we could elegantly move the two ENV Vars related to MapLibre usage within iOS together, instead of having two needed in the future?

Cheers 🍻

@@ -98,6 +98,9 @@ Pod::Spec.new do |s|

s.subspec 'DynamicLibrary' do |sp|
sp.source_files = "ios/RCTMGL/**/*.{h,m}"
if $RNMGL_USE_MAPLIBRE
sp.compiler_flags = '-DRNMGL_USE_MAPLIBRE=1'
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain how this is relevant?
Haven't seen this come up again in your changes - does MapLibre require this somehow?

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It defines RNMGL_USE_MAPLIBRE preprocessor macro, so we can do #ifdef RNMGL_USE_MAPLIBRE in code

@mfazekas
Copy link
Contributor Author

I guess we could elegantly move the two ENV Vars related to MapLibre usage within iOS together, instead of having two needed in the future?

Well one variable can be used to consume MapLibre or even Mapbox via SPM.
RNMGL_USE_MAPLIBRE is so we don't use functions that are not present in recent MapLibre versions.

@mfazekas mfazekas merged commit aa730fd into master Oct 20, 2021
@mfazekas mfazekas deleted the mfazekas/map-libre-support branch October 20, 2021 11:46
ferdicus added a commit that referenced this pull request Oct 21, 2021
With the changes introduced through #1571 we can switch back to 5.12.0 per default now 👍🏿
ferdicus added a commit that referenced this pull request Oct 21, 2021
* fix(iOS): pin mapLibre back to `5.12.0`

With the changes introduced through #1571 we can switch back to 5.12.0 per default now 👍🏿

* update Changelog
sdacunha pushed a commit to sdacunha/maps that referenced this pull request Oct 25, 2021
* fix(iOS): pin mapLibre back to `5.12.0`

With the changes introduced through rnmapbox#1571 we can switch back to 5.12.0 per default now 👍🏿

* update Changelog
@doylemark
Copy link

 ERROR  Mapbox error Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00> {"filePath": "-[MGLNetworkConfiguration errorLog:]", "level": "error", "line": 129, "message": "Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00>"}
 ERROR  Mapbox error [event]:Setup [code]:-1 [message]:loading style failed: unsupported URL {"filePath": "virtual bool mbgl::MGLCoreLoggingObserver::onRecord(mbgl::EventSeverity, mbgl::Event, int64_t, const std::string &)", "level": "error", "line": 30, "message": "[event]:Setup [code]:-1 [message]:loading style failed: unsupported URL"}
 ERROR  Mapbox error Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00> {"filePath": "-[MGLNetworkConfiguration errorLog:]", "level": "error", "line": 129, "message": "Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00>"}
 ERROR  Mapbox error [event]:Style [code]:-1 [message]:Failed to load source composite: unsupported URL {"filePath": "virtual bool mbgl::MGLCoreLoggingObserver::onRecord(mbgl::EventSeverity, mbgl::Event, int64_t, const std::string &)", "level": "error", "line": 30, "message": "[event]:Style [code]:-1 [message]:Failed to load source composite: unsupported URL"}

@ferdicus The errors you mention here, I believe are caused by URLs prefixed "mapbox://" being interpreted as file paths.. Similar to "file://". On device iOS the style completely fails to load when these errors occur however 🤔

@go-sean-go
Copy link

@doylemark Did you ever solve the above? I'm on rnmapbox 8.5.0 + mapLibre 5.12.1. Same problem whether I implement $ReactNativeMapboxGLIOSVersion = '~> 6.4.1' or not.

I'm really fascinated by your observation on the file path - is there a solve?

@go-sean-go
Copy link

tested with styleUrl pointed to mapbox ('mapbox://styles/mapbox/dark-v10') with a valid accesstoken and got these errors. Not sure if related though 😕 Maybe just logger spam - posting nevertheless

 ERROR  Mapbox error Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00> {"filePath": "-[MGLNetworkConfiguration errorLog:]", "level": "error", "line": 129, "message": "Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00>"}
 ERROR  Mapbox error [event]:Setup [code]:-1 [message]:loading style failed: unsupported URL {"filePath": "virtual bool mbgl::MGLCoreLoggingObserver::onRecord(mbgl::EventSeverity, mbgl::Event, int64_t, const std::string &)", "level": "error", "line": 30, "message": "[event]:Setup [code]:-1 [message]:loading style failed: unsupported URL"}
 ERROR  Mapbox error Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00> {"filePath": "-[MGLNetworkConfiguration errorLog:]", "level": "error", "line": 129, "message": "Requesting: Requesting: %@ failed with error: %@ failed with error: <MGLNetworkConfiguration: 0x600001743f00>"}
 ERROR  Mapbox error [event]:Style [code]:-1 [message]:Failed to load source composite: unsupported URL {"filePath": "virtual bool mbgl::MGLCoreLoggingObserver::onRecord(mbgl::EventSeverity, mbgl::Event, int64_t, const std::string &)", "level": "error", "line": 30, "message": "[event]:Style [code]:-1 [message]:Failed to load source composite: unsupported URL"}

@ferdicus - I'm having this on my project now (see versions above) - in my case, it's preventing the map tiles from rendering/loading at all. Wondering whether you have any new intel on this since your post ~6 months ago?

Symptoms are that the map is not loading at all - though it's misleading because some devices will load it from a local cache. New installs on new devices always fail to render the map, however.

I'm on Apple Silicon - the root of all trouble & joy. ;)

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.

Build issue for ios in MGLModule.m Multiple Errors - MapLibre SDK
4 participants