Skip to content

Tip: Add a Layer to a map

Jeffrey Kemp edited this page Jul 20, 2019 · 7 revisions

Add a Layer to a map

This overlays a Google Maps Layer on the map, e.g.

  • Traffic: red lines where traffic is currently heavy
  • Transit: the public transport routes
  • Bicycle: bicycle routes

Pre-requisites:

  • You have installed plugin region_type_plugin_com_jk64_report_google_map_r1 to the application
  • You have set a valid Google Maps API Key

Instructions:

  1. Add a JK64 Report Google Map plugin region to a page

  2. Give the region a static id, e.g. mymap

  3. Add a Dynamic Action to the region

    Event = mapLoaded [JK64 Report Google Map R1]

    Selection Type = Region

    Region = (your map region)

  4. Add a True Action

    Action = Execute Javascript Code

    Code (for traffic layer) =

        var lyr = new google.maps.TrafficLayer();
        lyr.setMap(this.data.map);
    

    Code (for transit layer) =

        var lyr = new google.maps.TransitLayer();
        lyr.setMap(this.data.map);
    

    Code (for bicycle layer) =

        var lyr = new google.maps.BicyclingLayer();
        lyr.setMap(this.data.map);
    

    Fire On Page Load = No

For more details, and sample code, check out the DEMO.

You can’t perform that action at this time.