mapbox-android-demo icon indicating copy to clipboard operation
mapbox-android-demo copied to clipboard

How to animate a line from start to stop from GeoJsonSource

Open ghost opened this issue 9 years ago • 4 comments

I'm drawing a list of line on Mapbox using LineLayer from GeoJson file:

    try { 
        GeoJsonSource geoJsonSource = new GeoJsonSource("source", loadJsonFromRaw());
        mapboxMap.addSource(geoJsonSource);
 
        LineLayer lineLayer = new LineLayer("line-layer", "source");
        lineLayer.setProperties(
                PropertyFactory.lineWidth(1f), 
                PropertyFactory.lineColor(Color.RED)
        ); 
 
        mapboxMap.addLayer(lineLayer);
    } catch (IOException e) {
        e.printStackTrace();
    } 

Everything is ok, the lines could be drawn. But now, I want to animate the lines from start point to end point of each line when MapBox renders them. From MapBox doc:

A benefit of having your data inside a GeoJSON source is that you can update, remove, or add additional features inside the source at any time, providing a solution to animating data in your map through the Runtime Styling API. For example, using an Android ValueAnimator, you can move a feature by updating its coordinates within the GeoJSON data.

But I don't know how to do it, tried to search on internet and SO but got nothing, does anyone know how to do it? Thanks.

(Sorry if this is not the right place to post my issue)

ghost avatar Aug 22 '17 04:08 ghost

Hey @viettanbkdn , thanks for using Mapbox. Did you manage to figure this out or not yet?

langsmith avatar Sep 22 '17 00:09 langsmith

Closing for now because of no response. Will re-open if conversation picks back up.

langsmith avatar Oct 20 '17 23:10 langsmith

I find that ios and js both have an example shows how to animate a line from start point to end point, but android demo didn't have one, can android sdk do the same thing?

yyyyyyyyyunf avatar Apr 02 '19 07:04 yyyyyyyyyunf

Hey @zongyunfeng , thanks for looking into Mapbox.

See https://github.com/mapbox/mapbox-android-demo/pull/998 and https://github.com/mapbox/mapbox-android-demo/pull/973.

langsmith avatar Apr 02 '19 16:04 langsmith