Add Bicycle Layer

This topic contains 5 replies, has 3 voices, and was last updated by  Paolo 9 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: ,

  • Author
    Posts
  • #15924

    Chris Clinton
    Free User
    Post count: 29

    Is there a way to add a Google map layer to the main map?
    For instance, Google offers a bicycle layer to show trails and paths.
    https://support.google.com/maps/answer/3092439?hl=en
    We are using GeoDirectory to show bicycle related items in town. It would be great if we could over the bicycle layer as well.

    #15940

    Guust
    Moderator
    Post count: 29970

    Have a look at this article:
    http://docs.wpgeodirectory.com/customised-maps/

    But I am not sure how you can add layers. I think that would require customization of the google map files. Not even sure if that is possible.

    #15944

    Chris Clinton
    Free User
    Post count: 29

    Thanks, Guust.

    I found this on Google’s developer site at https://developers.google.com/maps/documentation/javascript/trafficlayer#bicycling_layer.

    
    
    
    function initialize() {
      var myLatlng = new google.maps.LatLng(42.3726399, -71.1096528);
      var mapOptions = {
        zoom: 14,
        center: myLatlng
      };
    
      var map = new google.maps.Map(
          document.getElementById('map-canvas'),
          mapOptions);
    
      var bikeLayer = new google.maps.BicyclingLayer();
      bikeLayer.setMap(map);
    }
    
    google.maps.event.addDomListener(window, 'load', initialize);
    

    Looking at the code on the page you linked to, I am thinking I could modify it like this:

    
    
    
    add_action('wp_footer' , 'geodir_set_custom_map_style');
    function geodir_set_custom_map_style()
    {
    ?>
    <script>
    var geodir_custom_map_style =[
    // Google Map Bicycling Layer Starts Here
    
    function initialize() {
      var map = new google.maps.Map(
          document.getElementById('map-canvas'),
          mapOptions);
    
      var bikeLayer = new google.maps.BicyclingLayer();
      bikeLayer.setMap(map);
    }
    
    google.maps.event.addDomListener(window, 'load', initialize);
    
    // Google Map Bicycling Later End Here
    ]
    </script>
    <?php
    }
    

    Your thoughts?

    #15945

    Chris Clinton
    Free User
    Post count: 29

    I tested it and it’s not working.

    Seeking suggestions on how to edit code.

    #15955

    Guust
    Moderator
    Post count: 29970

    Maybe somebody else knows how to do this.
    It might require a change to
    /wp-content/plugins/geodirectory/geodirectory-functions/map-functions/js/map.js

    #15976

    Paolo
    Site Admin
    Post count: 31206

    Moved this to Jobs, as it requires customization.
    Thx

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket