WordPress.org

Ready to get started?Download WordPress

Forums

Comprehensive Google Map Plugin
[resolved] Directions to: current Google latitude Location (24 posts)

  1. vjblaze
    Member
    Posted 1 year ago #

    I'm loving this plugin, but I'm having to use another plugin to track my current Google latitude location called (Google Latitude History)

    http://wordpress.org/extend/plugins/google-latitude-history/

    The plugin works great for geo tracking but lacks everything Comprehensive Google Map Plugin offers.

    Basically, instead to have to list a specific address I rather like your plugin to use google latitudes current location. This would be very helpful for those looking for directions to my current position.

    Thank you!

    http://wordpress.org/extend/plugins/comprehensive-google-map-plugin/

  2. themc
    Member
    Posted 1 year ago #

    indeed this would also solve my problem.

  3. themc
    Member
    Posted 1 year ago #

    any progress on this? i got the feeling the this plugin support dies out...
    i am looking into this gps thing myself maybe i can get the code from another script to build it into this one. i i succeed ill post the package here.

  4. themc
    Member
    Posted 1 year ago #

    i made some progress this morning.

    using:

    http://ianluckraft.co.uk/2011/04/google-maps-v3-and-geolocation/

    simply added the code for geo to the js scripts in assets.

    now in google and safari and on mobile it says do you allow the app .... to use your location.

    so far so good. next stop getting de marker to appear at the map and zoom in... its difficult for me cause i dont have the exp with js.

    so its a lot of cut and past.

    so far i used from what i found in the link at the bottom of the 2 framework files then it calls the gps from site / mobile device....

    i think i need to search elsewhere to make it call a marker in the map anybody with js exp can take a look ?

  5. vjblaze
    Member
    Posted 1 year ago #

    This is a good start... when I have time I'll see what I can do!

  6. themc
    Member
    Posted 1 year ago #

    according to sites the javascript should be from google so i added that js code to my javascript files.

    this kinda code :

    <script>
     // Load the map scripts
     google.load('maps', '3', {other_params:'sensor=true'});
    
     // Function to create a map and check for geolocation
     function mapInit() {
    
     // Set the options to be used when creating the map
     var myOptions = {
     zoom: 0,
     center: new google.maps.LatLng(0, 0),
     mapTypeId: google.maps.MapTypeId.ROADMAP
    // Check if the browser supports geolocation
     if(navigator.geolocation) {
    
     navigator.geolocation.getCurrentPosition(currentPositionCallback);
    
     } else {
    
     alert('The browser does not support geolocation');
    
     }
    
     }
    
     function currentPositionCallback(position) {
    
     // Create a new latlng based on the latitude and longitude from the user's position
     var user_lat_long = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
    
     // Add a marker using the user_lat_long position
     var marker = new google.maps.Marker({
     position: user_lat_long,
     map: map
     });
    
     // Set the center of the map to the user's position and zomm into a more detailed level
     map.setCenter(user_lat_long);
     map.setZoom(15);
    
     }
    
     google.setOnLoadCallback(mapInit);
    
    </script>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    is for html documents.but to make it work in the plugin it needs to be added to another file (like html would be added) i tried the php files but no good so far. also in assets / html some files still trying to get it to work do.

  7. themc
    Member
    Posted 1 year ago #

    ok for anybody who wants to know or get to my pint of procces on this thing.

    i got the navigation to go but im stuck at displaying the marker on the map.

    go to asstes/js and open cgmp.framework.min.js
    at the bottom of the js add the following code.

    // Check if user support geo-location
    if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
    var latitude = position.coords.latitude;
    var longitude = position.coords.longitude;
    var geolocpoint = new google.maps.LatLng(latitude, longitude);

    var mapOptions = {
    zoom: 8,
    center: geolocpoint,
    mapTypeId: google.maps.MapTypeId.HYBRID
    }
    // Place a marker
    var geolocation = new google.maps.Marker({
    position: geolocpoint,
    map: map,
    title: 'Your geolocation',
    icon: 'http://labs.google.com/ridefinder/images/mm_20_green.png'
    });
    });
    }

    where the following code (last part of it should get a marker on screen at your location.. however its not wich means that getting the markers on the map comes from somewhere else.

    // Place a marker
    var geolocation = new google.maps.Marker({
    position: geolocpoint,
    map: map,
    title: 'Your geolocation',
    icon: 'http://labs.google.com/ridefinder/images/mm_20_green.png'
    });
    });
    }`

    the first part of the code however activates the gps for maps

    but even then we need t put this plugin to load https://maps.googleapis.com/maps/api/js?v=3&sensor=true thats need for the marker to work.

  8. themc
    Member
    Posted 1 year ago #

    ok im stuck at this. i tweeted the plugin creator Alexander Zagniotov to ask him for an update with geolocation.

  9. vjblaze
    Member
    Posted 1 year ago #

    Just found this how-to, but haven't had time to test it out.
    looks like a possible solution to our problem/request.

    Google Latitude Mashup with Google Maps:
    http://bestfromgoogle.blogspot.com/2011/05/google-latitude-mashup-with-google-maps.html?m=1

    I'm still actively sourcing a solution so if anyone finds a fix please let us know, thx!

  10. themc
    Member
    Posted 1 year ago #

    il look into the link you posted. see if we can make it work. ill let you now.

  11. themc
    Member
    Posted 1 year ago #

    i got a script build up.

    its fully no errors should work but its not showing geolocation and the marker on the spot. maybe you guys can take a look.

    http://pastebin.com/xYt55sTA

    i think where nearly there we just need somebody with js experience to alter this script and then i believe it will work.

  12. themc
    Member
    Posted 1 year ago #

    sorry made an error below is the correct code.

    the scripts load the page but its terribly slow. ill see if i can get somebody with the js exp to look at it.

    http://pastebin.com/GvZDPFPT

  13. themc
    Member
    Posted 1 year ago #

    finnaly some progress.

    it shows a bubble with the text found your location in firefox.

    (using a fake location)

    so far

    http://pastebin.com/vFjZTutj

    here is the working script for anybody to try or upgrade. more help with this is appreciated.

  14. themc
    Member
    Posted 1 year ago #

    after map.setCenter(pos); add map.setZoom(18); to zoom on location when location is found.

    map.setCenter(pos);
    map.setZoom(18);

    so geolocation is working next up is a marker and the directions fill. (so point 1 auto fills with location)

    your welcome so far.

  15. themc
    Member
    Posted 1 year ago #

    and btw you can easy moddify the tekst from the balloon by edditing the content: 'Hier bent U' in
    var infowindow = new google.maps.InfoWindow({
    map: map,
    position: pos,
    content: 'Hier bent U'
    });

  16. themc
    Member
    Posted 1 year ago #

    quick summary:

    copy the code from http://pastebin.com/vFjZTutj and add it to your cgmp.framework.min.js (make sure its the min one) (overwritte the entire page with the code from pastebin) the save.

    you can find the file in the assets folder then js.

    geolocation should now work.

    to zoom in after geo is found:
    after map.setCenter(pos); add map.setZoom(18); to zoom on location when location is found.

    map.setCenter(pos);
    map.setZoom(18);

    to change the geoballoon text.
    edit the content: ''Location found using HTML5' in
    var infowindow = new google.maps.InfoWindow({
    map: map,
    position: pos,
    content: ''Location found using HTML5'
    });

  17. vjblaze
    Member
    Posted 1 year ago #

    It's been a crazy past couple months and just noticed google will expire Google Location History API today, 9 August. Themc, is this going to effect your coding?

    Also, do you have a live running demo of your modded plugin we can view in action?

  18. themc
    Member
    Posted 1 year ago #

    hey vjblaze unfortunately i cant show my page in action its running with advertisements and info thats customer related only. our company wont allow a login and password in the wild.

  19. themc
    Member
    Posted 1 year ago #

    its not affecting my coding.

    everything works great. im currently struggeling to get directions field A filled in by the gps coordinates of the user.

    since point B is auto filled with a mashup mode.

  20. themc
    Member
    Posted 12 months ago #

    im struggeling with this part ...

    $(parentInfoBubble + ' a.dirToHereTrigger').live("click", function() {
    var thisId = this.id;
    if (thisId == 'toHere-' + localBubbleData.bubbleHolderId) {
    $(dirDivId).fadeIn();
    $(dirDivId + ' input#a_address').val(location);
    $(dirDivId + ' input#b_address').val(addy);
    $(dirDivId + ' input#radio_km').attr("checked", "checked");
    }
    });

    $(parentInfoBubble + ' a.dirFromHereTrigger').live("click", function() {
    var thisId = this.id;
    if (thisId == 'fromHere-' + localBubbleData.bubbleHolderId) {
    $(dirDivId).fadeIn();
    $(dirDivId + ' input#a_address').val(addy);
    $(dirDivId + ' input#b_address').val('');
    $(dirDivId + ' input#radio_km').attr("checked", "checked");
    }
    });

    im using (location) for the input a adress field in to here.

    this will get the location but its the location of the website instead of the persons geo location. when using pos or position or current position it breaks the script. anybody here with enough knowledge to give it a push ?

  21. themc
    Member
    Posted 12 months ago #

    the prob is that i cant recall on the var pos.

    this make it so that i cant recall on my geolocation at the adress field around the bottom of the script.

    else i could use the location and if needed format the output to lat/long like the addy part.

    ive updated my script so it shows a marker and text balloon at the users current position. zooming on location will happen after a few secs.

    cmpg.framework.min.js replace the content from your file in /js with this file.

    http://pastebin.com/1NtQEAcC

    what the file does:
    *its working with the lastest wp 3.6
    *it activates geolocation (user positioning)
    *it zooms in on geolocation and input the text ballon location found + a pin.

    *still need to find out (need help with) direction point a linking to coords from user position.

  22. themc
    Member
    Posted 10 months ago #

    anybody that can help with linking start pos A to the users gps coordinates ?

    point b will be auto filled by the mashup ussing the addy part.

  23. alexanderzagniotov
    Member
    Plugin Author

    Posted 8 months ago #

    themc, lets have a chat in private?

  24. themc
    Member
    Posted 8 months ago #

    sure u can mail me at wouter@websiteenapp.nl

Topic Closed

This topic has been closed to new replies.