question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use Mapbox style URL with MapLibre

See original GitHub issue

Describe the bug

When using MapLibre, it cannot display Mapbox style url like: ‘mapbox://styles/mapbox/outdoors-v11’

To Reproduce

  1. Install react-native-mapbox-gl/maps: 8.5.0
  2. Install maplibre for iOS: 5.12.2
  3. MapView styleURL={‘mapbox://styles/mapbox/outdoors-v11’}

Example:

import React from 'react';
import {
  MapView,
} from '@rnmapbox/maps';

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView styleURL={'mapbox://styles/mapbox/outdoors-v11'}>
      </MapView>
    );
  }
}

Expected behavior
Show the Mapbox style.

Actual behavior
White screen, no map.

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”}

Versions:

  • Platform: iOS, Android very likely
  • Platform OS: iOS 15.4.1
  • Device: iPhone 8 Plus
  • Emulator/ Simulator: no
  • Dev OS: macOS Montery 12.3.1
  • @rnmapbox/maps Version 8.5.0
  • Maplibre ios-v5.12.2
  • React Native Version 0.66.4

Possible solution
maplibre PR #90

Set the MGLSettings useWellKnownTileServer to MGLMapbox.

[MGLSettings useWellKnownTileServer:]; Possible options are: MGLMapLibre, MGLMapbox and MGLMapTiler.

File to modify: maps/ios/RCTMGL/MGLModule.m

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mfazekascommented, Jun 9, 2022

This should be fixed with MapboxGL.setWellKnownTileServer(MapboxGL.TileServers.Mapbox) in recent versions

2reactions
hexadecycommented, May 15, 2022

A Quick patch for iOS: https://github.com/Hortau/maps/commit/a6c3c7fee83b044961a0f9707557f503c9a0eafa The Android version of Maplibre has breaking changes with rnmapbox 8.5.0.

npmjs: @hortau/maps:8.5.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maplibre x MapBox API · Discussion #1226 - GitHub
I am trying to use Maplibre with the Mapbox API as describes here, ... It's mostly updating the urls in your style to...
Read more >
style URL | Help - Mapbox docs
You can find the style URL on your Styles page in Mapbox Studio. Click on the menu next to a style to reveal...
Read more >
Sources | Style Specification | MapLibre GL JS Docs
All layers that use a vector source must specify a "source-layer" value. For vector tiles hosted by Mapbox, the "url" value should be...
Read more >
Style Specification | MapLibre GL JS Docs
This specification defines and describes the visual appearance of a map: what data to draw, the order to draw it in, and how...
Read more >
Map | MapLibre GL JS Docs
The map's MapLibre style. This must be an a JSON object conforming to the schema described in the MapLibre Style Specification , or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found