Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Modifying GeoJsonSource data does not invalidate layers #6744

Closed

Description

@sddamico

Platform: Android
Mapbox SDK version: 4.2.0-beta.3

Steps to trigger behavior

Copied from #6612 (comment)

It should be noted that the same behavior is seen if one changes the backing data in a geojson source
(e.g. layers not not invalidating until the map is invalidated by zoom or some other event)

String serializedGeoJsonData = getNewGeoJsonData();
final GeoJsonSource source = mapboxMap.getSourceAs("geoJsonData");
source.setGeoJson(serializedGeoJsonData);

A perhaps important note is that the source that I am modifying the data of is initialized as an empty feature collection in our style:

"geoJsonData": {"data": {"type": "FeatureCollection", "features": []}, "type": "geojson"}

Expected behavior

Layers invalidate when their backing source data changes

Actual behavior

Layers do not invalidate

Activity

  1. added
    Android
    on Oct 19, 2016
  2. added this to the android-v4.2.0 milestone on Oct 19, 2016
  3. zugaldia commented on Oct 19, 2016

    @zugaldia
    Member
  4. self-assigned this
    on Oct 19, 2016
  5. ivovandongen commented on Oct 19, 2016

    @ivovandongen
    Contributor

    @sddamico I've tried to reproduce this, but it works fine for me. If I create an empty style, with only an empty geojson source and a single layer referencing it (json file), I can update it from code like:

    GeoJsonSource source = map.getSourceAs("parks-source");
    String json = readRawResource(R.raw.amsterdam);
    source.setGeoJson(json);
    

    (where readRawResource reads the json from somewhere)

    Additional updates also take immediate effect.

    Please create a minimal case to reproduce if this remains an issue after reviewing your code/style. Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Androidruntime styling

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions