maps icon indicating copy to clipboard operation
maps copied to clipboard

[Bug]: Does MapboxGL.offlineManager.createPack support custom styles?

Open vienha opened this issue 1 year ago • 9 comments

Mapbox Implementation

Mapbox

Mapbox Version

10.1.31

React Native Version

0.75.4

Platform

iOS, Android

@rnmapbox/maps version

0.75.4

Standalone component to reproduce

 import Mapbox, {
  Camera,
  MapView,
  offlineManager,
  StyleURL,
} from '@rnmapbox/maps';
import React, { useState } from 'react';
import { Button, Dimensions, TextInput } from 'react-native';
Mapbox.setAccessToken('my_token_here');
const OfflineExample = () => {
  const [packName, setPackName] = useState('offlinePack');
  const [showEditTitle, setShowEditTitle] = useState(false);
  const STYLE_URL = 'custom_style_url'
  const CENTER_COORD =[105.928, 21.0087];
  return (
    <>
      <Button
        title="Create Pack"
        onPress={() => {
          const options = {
            name: packName,
            styleURL: STYLE_URL,
            bounds: [
            [105.517826, 20.90185],
            [105.906464, 21.204365],
          ],
            minZoom: 0,
            maxZoom: 17,
            metadata: {
              whatIsThat: 'foo',
            },
          };
          console.log("options", JSON.stringify(options));
          offlineManager.createPack(options, (region, status) =>
            console.log('=> progress callback region:', 'status: ', status),(region,sattus)=>{
               console.log("Lỗi tải gói: " + sattus);
            }
          );
        }}
      />
      <MapView style={{ flex: 1 }} styleURL={STYLE_URL}>
        <Camera zoomLevel={10} centerCoordinate={CENTER_COORD} />
      </MapView>
    </>
  );
};
export default OfflineExample;

Observed behavior and steps to reproduce

When i call the offlineManager.createPack method, I receive the status:

{"completedResourceCount": 0, "completedResourceSize": 0, "erroredResourceCount": 0, "loadedResourceCount": 0, "loadedResourceSize": 0, "name": "offlinePack", "percentage": NaN, "requiredResourceCount": 0, "state": "complete"}

I wonder if rnmapbox supports creating offline packs with custom styles?

Expected behavior

I want to get the following result.

{"completedResourceCount": 1, "completedResourceSize": 23786585, "erroredResourceCount": 0, "loadedResourceCount": 0, "loadedResourceSize": 0, "name": "offlinePack", "percentage": 3.225806451612903, "requiredResourceCount": 31, "state": "active"}

Notes / preliminary analysis

No response

Additional links and references

No response

vienha avatar Oct 11 '24 02:10 vienha

I have the same issue

PeterFred avatar Oct 13 '24 21:10 PeterFred

@PeterFred Have you found a solution to this problem yet?

vienha avatar Oct 14 '24 02:10 vienha

@veinha unfortunately no. It is holding up our upgrade, as we have it working for Mapbox 8.5.0 We used this implementation with a JSON file which works well in 8.5. But in 10 we are getting the same as you. https://ospfranco.com/post/2020/08/04/use-the-mapbox-sdk-to-render-any-tile-set/

PeterFred avatar Oct 21 '24 17:10 PeterFred

Do you happen to have any news on this one? I use it with a custom style from Maptiler and can not create offline packs.

huylocit14054 avatar Dec 05 '24 03:12 huylocit14054

I have the same issue. Did anyone find a solution for this?

luciman avatar Jan 09 '25 21:01 luciman

I'm facing the same issue. I need to create an offlinePack using the createPack helper because my app hangs on iOS when navigating to a new location using the flyTo helper, especially when zoomed in or after zooming in at the destination. This problem only occurs on iOS; everything works fine on Android. I'm currently stuck and would appreciate any guidance on how to resolve this.

avinash2407 avatar Jan 20 '25 21:01 avinash2407

@mfazekas is their any scope to getting offlineManager for custom styles working?

PeterFred avatar Jan 21 '25 19:01 PeterFred

Not being able to set a custom object or JSON URL is a huge drawback, any news on this?

timbtimbtimb avatar Apr 16 '25 19:04 timbtimbtimb

Your only option is to use OfflineManagerLegacy and make your voice heard by the MapBox business team here

timbtimbtimb avatar Apr 16 '25 21:04 timbtimbtimb

upstream issue, closing

mfazekas avatar Oct 16 '25 21:10 mfazekas