maplibre-native icon indicating copy to clipboard operation
maplibre-native copied to clipboard

Disable default style

Open birkskyum opened this issue 2 years ago • 5 comments

The default style points towards the demo tiles, generating a lot of traffic towards them, and it should be set explicitly instead.

For projects that load the style async, the current implementation will briefly load demo-tiles, and then swap them with the intended style afterwards.

https://github.com/maplibre/maplibre-gl-native/blob/5a181c15742a3a35dc1a92782946b41ae2f9cbdd/src/mbgl/util/tile_server_options.cpp#L209-L228

birkskyum avatar Jan 19 '23 10:01 birkskyum

@birkskyum what do you mean with set explicitly? Can you give an example? Thanks!

ovivoda avatar Jan 27 '23 08:01 ovivoda

I just mean that we can't have a default value there, so the style should either be provided on initialization or a set command after

birkskyum avatar Jan 27 '23 09:01 birkskyum

Aren't the demotiles hosten on GitHub?

Does it matter that it generates a lot of traffic?

louwers avatar Mar 01 '23 10:03 louwers

They are hosted on GitHub and served through cloudflare. Cloudflare donated us some free services, so it does not directly produce cost for us, but I think the default behavior should be that nothing is shown if you do not set explicitly a style path.

wipfli avatar Mar 01 '23 18:03 wipfli

Indeed, we can confirm that the demo style is requested despite of custom style being configured before the map is added to the view hierarchy. Error logs indicate that the load of external style.json was attempted and timed out

Task <9B3323BB-5C17-4712-A2D5-8E713A107533>.<1> finished with error [-1'001] 
Error Domain=NSURLErrorDomain Code=-1001 "Zeitüberschreitung bei der Anforderung." 
UserInfo={_kCFStreamErrorCodeKey=-2103, 
_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <9B3323BB-5C17-4712-A2D5-8E713A107533>.<1>,
_NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <9B3323BB-5C17-4712-A2D5-8E713A107533>.<1>"
), NSLocalizedDescription=Zeitüberschreitung bei der Anforderung., 
NSErrorFailingURLStringKey=https://demotiles.maplibre.org/style.json, 
NSErrorFailingURLKey=https://demotiles.maplibre.org/style.json, 
_kCFStreamErrorDomainKey=4}

r3econ avatar Jan 24 '24 20:01 r3econ