-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Setting a layout property needs to trigger tile reparse #5701
Comments
Right now, we're throwing away the parsed representation of a tile after we created all buckets, and when reparsing a tile, we'll have to do a new request (which is fast because it'll likely be served from cache, but still slower because it needs to be decompressed etc.). We should change this behavior and instead have all tiles/buckets hang on to the data they loaded so that we can do faster reparses. |
Is there some workaround on Android to force the reparse after changing runtime styles until this gets fixed? |
Adding and removing layers seems to cause reloads, so perhaps a dummy (possibly even unstyled?) layer could help here. |
Unfortunately I can't seem to get things to re-render even by adding a layer. However in trying it I got this simple way to replicate the issue, at least on my Nexus 5X with 6.0.1. map.getMapAsync(new com.mapbox.mapboxsdk.maps.OnMapReadyCallback() {
@Override
public void onMapReady(final MapboxMap mapboxMap) {
mapboxMap.setCameraPosition(new CameraPosition.Builder().target(new LatLng(60.186132, 24.827881)).zoom(18).build());
addOnMapChangedListener(new com.mapbox.mapboxsdk.maps.MapView.OnMapChangedListener() {
@Override
public void onMapChanged(int change) {
if(change == DID_FINISH_LOADING_MAP) {
FillLayer layer = new FillLayer("force-refresh", "composite");
layer.setSourceLayer("landuse");
layer.setFilter(Filter.eq("class", "grass"));
layer.setProperties(PropertyFactory.fillColor("#ff0000"));
layer.setMinZoom(9);
layer.setMaxZoom(22);
mapboxMap.addLayer(layer);
}
}
});
}
}); |
Behaviour above also confirmed with the Android Demo App's SimpleMapViewActivity after updating to latest sdk snapshot and making the following change: @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_basic_simple_mapview);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final MapboxMap mapboxMap) {
mapboxMap.setCameraPosition(new CameraPosition.Builder().target(new LatLng(60.186132, 24.827881)).zoom(18).build());
mapView.addOnMapChangedListener(new com.mapbox.mapboxsdk.maps.MapView.OnMapChangedListener() {
@Override
public void onMapChanged(int change) {
if(change == DID_FINISH_LOADING_MAP) {
FillLayer layer = new FillLayer("force-refresh", "composite");
layer.setSourceLayer("landuse");
layer.setFilter(Filter.eq("class", "grass"));
layer.setProperties(PropertyFactory.fillColor("#ff0000"));
layer.setMinZoom(9);
layer.setMaxZoom(22);
mapboxMap.addLayer(layer);
}
}
});
}
});
} |
This is currently a blocker for runtime style API on both mobile platforms (and core technically, as well). Anything involving styling existing layers (and not adding or removing a layer) triggers this bug and doesn't show style updates. |
This looks kind of tricky. Currently, the data (
I'm not seeing a simple way to introduce retention for purposes of re-layouts to this scheme.
What does GL JS do? The worker is responsible for making the request. When parsing and layout are complete, it transfers the raw data to the main thread but retains a reference to the parsed representation for subsequent re-layouts. The main thread lazily reparses the raw data for |
@jfirebaugh would it be OK to defer |
No, |
@jfirebaugh how about just not allowing it while reload is in progress? I could be an OK tradeoff. |
Not allowing would manifest pretty weirdly in the mobile SDKs, for one. The querying feature would just not work intermittently if runtime styling was involved, for example. |
I'm going to introduce a layer of indirection, and have |
Hi, I'm experiencing a bug where updating a layer filter (setting the NSPredicate in iOS) fails to update (or invalidate) a source that's currently not visible, causing it to show with the old filter when re-appering. Given a MGLVectorSource with minzoom=maxzoom=9 and a MGLLineStyleLayer with minzoom=9, maxzoom=13 and a filter/predicate A.
I found that in the Maybe @kkaefer have some ideas? |
@jonkan Can you please file a new issue? |
Sure! #8505 |
When a layout property is modified, all existing tiles for that source need to be reparsed, so that vertex arrays that are calculated based on that property are recalculated.
This will fix #5610 (comment).
Additionally, once data-driven-styling lands, modifying a data-driven paint property also needs to trigger a reparse.
We should port the general strategy for batched updates from gl-js -- see mapbox/mapbox-gl-js#2355 and the current style.js.
cc @ivovandongen @mourner @kkaefer
The text was updated successfully, but these errors were encountered: