Skip to content

Blank maps when using local mbtiles with local style on iOS #1411

Answered by polvi
prawel asked this question in Q&A
Discussion options

You must be logged in to vote

Here is my attempt that appears to work. Very hackey and would love any suggestions to improve. style.json and APT_BASE.mbtiles are bundled with the app. Definitely open to suggestions but this does work for me. Essentially it is grabbing the mbtiles location and runtime, and rewriting the style.json with that value.

struct MapView: UIViewRepresentable {
    func makeUIView(context: Context) -> MGLMapView {
        let mapView = MGLMapView(frame: .zero)
        mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        mapView.delegate = context.coordinator
        
        
        guard let localMbtiles = Bundle.main.url(forResource: "APT_BASE", withExtension: "mbtiles") else {

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by louwers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working iOS
4 participants
Converted from issue

This discussion was converted from issue #1366 on July 24, 2023 19:57.