Back

Creating Realtime Bicycling Layer

In order to create a realtime bicycling layer, call the ShowBicyclingLayer method of the map object like this:

 map.ShowBicyclingLayer()

And yess, you got it. A realtime bicycling layer is plotted on the map. Just like that.


Bicycling Layer Example

app.LoadPlugin("MapView");

function OnStart() {
    lay = app.CreateLayout("Linear", "VCenter, FillXY");
    
        var apiKey = "AIzaSyD2eHntKEmh272p3ac6YjWPbPkwo3m2mck";
        
        map = app.CreateMapView(apiKey, 0.9, 0.5, 7.0689323, 125.6114588, 13);
        map.SetOnReady(MapOnReady);
        lay.AddChild(map);

        btnShow = app.CreateButton("Show");
        btnShow.SetOnTouch(BtnOnTouch);
        btnShow.Hide();
        lay.AddChild(btnShow);

        btnHide = app.CreateButton("Hide");
        btnHide.SetOnTouch(BtnOnTouch);
        btnHide.Hide();
        lay.AddChild(btnHide);
    app.AddLayout(lay);
}
function MapOnReady() {
    btnShow.Show();
    btnHide.Show();
}
function BtnOnTouch() {
    if(this.GetText() == "Show") {
        map.ShowBicyclingLayer();
    } else {
        map.HideBicyclingLayer();
    }
}
Copy    Run   

ShowBicyclingLayer()
This will initialize an instance of the BicyclingLayer class and show the layer into the map.

HideBicyclingLayer()
This will hide the BicyclingLayer object in the map. This will not destroy object. Call the ShowBicyclingLayer() method to show it again.

RemoveBicyclingLayer()
This will completely destroy BicyclingLayer object.