Mapbox-gl-native: Offline packs that reference a local style return an MGLOfflinePackError

Created on 11 Sep 2017  ·  13Comments  ·  Source: mapbox/mapbox-gl-native

Platform: iOS
Mapbox SDK version: 3.6.2, 3.5.2

Steps to trigger behavior

  1. Create a new map view that references a local style JSON:
NSURL *localStyle = [[NSBundle mainBundle] URLForResource:@"test-style" withExtension:@"json"];
self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds styleURL:localStyle];
  1. Create a new MGLTilePyramidOfflineRegion
  2. Create an offline pack with a completion handler to log errors

Expected behavior

The offline pack should download successfully and not return this error.

Actual behavior

The offline pack fails to download and returns an error: Response class is not NSHTTPURLResponse

The error is seen both raster and vector styles, so I suspect the error may be caused how local resources are being handled.

Core bug offline

Most helpful comment

Hi all, we agree being able to use an offline pack with a local ("offline") style makes sense and should be supported. we're reprioritizing this issue and hope to get it fixed this month. Thanks for your patience!

All 13 comments

Using asset://localStyle.json gives a more informative error when trying to download offline resources:

Offline pack "My Offline Pack" has 0 of 1 resources — 0.00%.
Offline pack "My Offline Pack" received error: unsupported URL

Any style will probably fail in this way, but here is an extremely simple style that is known to reproduce the issue.

In any case, in “online” mode the style loads, its remote resources are downloaded, and the map displays as expected. The issue here is that remote resources from locally-bundled styles cannot be saved as part of offline packs.

/cc @kkaefer @1ec5

asset:// URLs are not supported for offline downloads. You must use a mapbox:// or http:///https:// URL.

asset:// URLs are not supported for offline downloads. You must use a mapbox:// or http:///https:// URL.

Can you say more about why this limitation exists for styles?

Are there any solution to this issue?
How do I download for example a style with a image raster source that points to a Geoserver to an offline pack?

What do you mean above with You must use a mapbox://or http:/// https:// URL?
How do I use https://? @jfirebaugh

Any updates on this issue? I'm running into the same problem.

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

Any updates on this issue?

Hi all, we agree being able to use an offline pack with a local ("offline") style makes sense and should be supported. we're reprioritizing this issue and hope to get it fixed this month. Thanks for your patience!

Do you have any new about this ? Thanks ! 😁

Any updates?

I am running into the same problem on Android
@chloekraw Any updates on this issue? Thanks! 😃

Any updates on this issue? asset:// URLs seem to be broken with MGLMapSnapshotter.

I am also running into this issue on Android. It does not matter if I use the OfflineManager from the sdk directly or if I use the OfflinePlugin, with both ways the download does not start and I only see the following line in the log:

Mbgl-HttpRequest: [HTTP] Unable to parse resourceUrl asset://app/styles/<style-file-name>.json

Was this page helpful?
0 / 5 - 0 ratings