title: How to color polyline/GeoJSON line by speed/altitude in MapBox?
body: <p>I want to draw a GPS track on a map (MapBox) and color its points by speed or altitude. So I need a custom drawer for the track.</p>
  
  <p>MapBox Android SDK provides an example of drawing a polyline with customized style:
  <a href="https://www.mapbox.com/android-sdk/examples/add-a-geojson-line/" rel="nofollow noreferrer">https://www.mapbox.com/android-sdk/examples/add-a-geojson-line/</a>
  But still it is a static style, which is not driven by data.</p>
  
  <p>This part of example is point of interest:</p>
  
  <pre><code>lineLayer.setProperties(
        PropertyFactory.lineDasharray(new Float[]{0.01f, 2f}),
        PropertyFactory.lineCap(Property.LINE_CAP_ROUND),
        PropertyFactory.lineJoin(Property.LINE_JOIN_ROUND),
        PropertyFactory.lineWidth(5f),
        PropertyFactory.lineColor(Color.parseColor("#e55e5e"))
      );
  </code></pre>
  
  <p><code>PropertyFactory</code> methods have implementations with <code>Function</code> parameter. I suspect it could be exactly what I search for. But no manual or example of using that implementations could be found.</p>
  
  <p>Any ideas about custom drawer?</p>
  
  <p>I develop a Xamarin.Android app in C# using MapBox Android SDK ported from Java.</p>
  
  <p>UPD:
  <code>Function</code> type definition as it is seen in assembly metadata is the following: </p>
  
  <pre><code>[JavaTypeParameters(new[] { "T" })]
  [Register("com/mapbox/mapboxsdk/style/layers/Function", DoNotGenerateAcw = true)]
  public class Function : Java.Lang.Object
  {
      protected Function(IntPtr javaReference, JniHandleOwnership transfer);
  
      public virtual Float Base { get; }
      protected override IntPtr ThresholdClass { get; }
      protected override Type ThresholdType { get; }
  
      [JavaTypeParameters(new[] { "T" })]
      [Register("stop", "(FLcom/mapbox/mapboxsdk/style/layers/Property;)Lcom/mapbox/mapboxsdk/style/layers/Function$Stop;", "")]
      public static Stop InvokeStop(float @in, Property output);
  
      [JavaTypeParameters(new[] { "I", "O" })]
      [Register("com/mapbox/mapboxsdk/style/layers/Function$Stop", DoNotGenerateAcw = true)]
      public class Stop : Java.Lang.Object
      {
          protected Stop(IntPtr javaReference, JniHandleOwnership transfer);
  
          [Register("in")]
          public Java.Lang.Object In { get; set; }
          [Register("out")]
          public Java.Lang.Object Out { get; set; }
          protected override IntPtr ThresholdClass { get; }
          protected override Type ThresholdType { get; }
      }
  }
  </code></pre>
  
  <p>UPD2:
  As I use C# things are a bit different from Java. Here is the code I am going to use:</p>
  
  <pre><code>LineLayer lineLayer = new LineLayer("linelayer", "line-source");
          lineLayer.SetProperties(new Property[] {
             PropertyFactory.LineColor("**What should be here?**"),
             PropertyFactory.Visibility(Property.Visible),
             PropertyFactory.LineWidth((Java.Lang.Float)3f)
          });
  </code></pre>