Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • brandzeichen Friend
    #207893

    Hi,

    I have mutliple markers/locations on my JA Map and need to have the possibility for people to get directly to Google Maps so they find the placed by Google route planner.

    The JA Maps plugin does not have an option like “get there” that would lead me to “real” Google Maps, right?

    I tried to implement a link in the embed-code so I could have a link in the tooltip at least but this did not work.

    Any suggestions how I can get this working?

    Thanks
    Chris

    Thanh Nguyen Viet Friend
    #575750

    Hello,

    To add link to google map page on Info window popup, please download the attache file (script.js.txt), and rename it to “script.js” file and replace the current file on your site
    plugins/system/jagooglemap/assets/script.js

    I have added some code snippet to add link on that file, in case you want to update the link, you can find a code like below:

    var lat = results[0].geometry.location.lat(),
    lon = results[0].geometry.location.lng();
    var link = 'https://www.google.com/maps/dir/'+lat+','+lon+'//@'+lat+','+lon+',16z';
    info += ' <a href="'+link+'" target="_blank">Get there</a>';

    and

    var link = 'https://www.google.com/maps/dir/'+lat+','+lon+'//@'+lat+','+lon+',16z';
    info += ' <a href="'+link+'" target="_blank">Get there</a>';


    1. script.js_.txt
    Thanh Nguyen Viet Friend
    #642079

    Hello,

    To add link to google map page on Info window popup, please download the attache file (script.js.txt), and rename it to “script.js” file and replace the current file on your site
    plugins/system/jagooglemap/assets/script.js

    I have added some code snippet to add link on that file, in case you want to update the link, you can find a code like below:

    var lat = results[0].geometry.location.lat(),
    lon = results[0].geometry.location.lng();
    var link = 'https://www.google.com/maps/dir/'+lat+','+lon+'//@'+lat+','+lon+',16z';
    info += ' <a href="'+link+'" target="_blank">Get there</a>';

    and

    var link = 'https://www.google.com/maps/dir/'+lat+','+lon+'//@'+lat+','+lon+',16z';
    info += ' <a href="'+link+'" target="_blank">Get there</a>';

    Thanh Nguyen Viet Friend
    #740739

    Hello,

    To add link to google map page on Info window popup, please download the attache file (script.js.txt), and rename it to “script.js” file and replace the current file on your site
    plugins/system/jagooglemap/assets/script.js

    I have added some code snippet to add link on that file, in case you want to update the link, you can find a code like below:

    var lat = results[0].geometry.location.lat(),
    lon = results[0].geometry.location.lng();
    var link = 'https://www.google.com/maps/dir/'+lat+','+lon+'//@'+lat+','+lon+',16z';
    info += ' <a href="'+link+'" target="_blank">Get there</a>';

    and

    var link = 'https://www.google.com/maps/dir/'+lat+','+lon+'//@'+lat+','+lon+',16z';
    info += ' <a href="'+link+'" target="_blank">Get there</a>';

    brandzeichen Friend
    #575817

    Hi,

    thanks, that’s cool, one last question: now it puts the location in the “travelling from” field in the Google maps route planner (upper field), So I have to switch the fields every time manually to have the target lodaction in “travelling there” (lower field). Can you change something in the script so it jumps to the lower field automatically?

    Thanks
    Chris

    Thanh Nguyen Viet Friend
    #575848

    <em>@brandzeichen 480552 wrote:</em><blockquote>Hi,

    thanks, that’s cool, one last question: now it puts the location in the “travelling from” field in the Google maps route planner (upper field), So I have to switch the fields every time manually to have the target lodaction in “travelling there” (lower field). Can you change something in the script so it jumps to the lower field automatically?

    Thanks
    Chris</blockquote>

    To set your location as destination, please open the script.js file that I mentioned above, and find the code snippet

    var link = 'https://www.google.com/maps/dir/'+lat+','+lon+'//@'+lat+','+lon+',16z';

    And replace it with:

    var link = 'https://www.google.com/maps/dir//'+lat+','+lon+'/@'+lat+','+lon+',16z';

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

This topic contains 6 replies, has 2 voices, and was last updated by  Thanh Nguyen Viet 8 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum