Active
Project:
GMap Module
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Aug 2009 at 15:14 UTC
Updated:
14 Jan 2013 at 13:53 UTC
Jump to comment: Most recent
Comments
Comment #1
apt94jesse commentedHey, you beat me to the punch with this question.
I'm using Views + Gmap + Location and rendering a map with node locations on it. I've dropped the javascript code into the footer of the view that pulls the lat/lon coords from the browser. It was originally from an iphone tutorial but seems to work on Firefox 3.5 as well.
It pulls the coords just fine and exports them below the rendered map, however I can't seem to get the two to play nice together. I want the coords be inserted as the map's center point.
You can view the test page here: www.coastalempire.com/savannah/maps
I've only been playing with this for a few hours so odds are I'll figure it out (or figure out why it isn't possible :p) pretty soon, but any collaboration would be awesome. If I come up with the answer, I'll post it here. It seems like it would be an awesome feature to include in the gmap module, or at least a separate contrib module.
Comment #2
apt94jesse commentedForgot to mention above: the test map has node locations in Savannah, GA. I've centered the map by default in Macon, GA. If you want to see Savannah and the node locations, just follow I-16 southeast from Macon and you'll see some default drupal markers at the coast.
Not sure if this is necessary for testing this but I figure it can't hurt.
Comment #3
bogdog400 commentedThanks for this. It was a big help. Let me know if you discover anything else. I want to work on some custom controls.
Comment #4
Sinan Erdem commentedAny improvements on this?? It would really be a nice option...
Comment #5
dflitner commentedI'd love this feature as well.
We're trying to build something similar to this site, but using Drupal instead. I'll try to kludge something together, but my javascript and php are a bit iffy.
Comment #6
dflitner commentedI've got this bunch of code
Which, when it's got the other "create map" stuff around it, works just great. However, I have no idea how to merge this with the gmap output. I am not a coder at all.
Is there a way to call this in a separate js file maybe and then programmatically add it to the gmap marker output?
Comment #7
vosechu commented#gmap-auto1map-gmap0 is the id of the map div. I don't quite know how this is set yet. My setCoords function doesn't work on load yet, but if you call it after load it will pan and zoom to the user's location. I'm experimenting with this as well but we'll get it soon.
Comment #8
vosechu commentedThis should do it for you pretty nicely I hope. Syntax is slightly weirder than I usually see in Drupal but I believe it is the correct way to do this in jQuery.
Note: This waits for 'markersready' since I'm putting markers on the map via the Views Gmap style, you may be able to change 'markersready' to just 'ready' and get some performance improvements (or it might just not work without the change, it's possible).
-Chuck
Comment #9
dflitner commentedThis looks fantastic. I'm also building my map using the Views Gmap style. Forgive me for being a goose though: where should this code go?
Comment #10
dflitner commentedDoes anyone know where this code should go? I've been trying to put it in various places in gmap.js but it doesn't appear to be working.
Comment #11
vosechu commented@dogmatix - This should go in your theme's js folder, but failing that you could drop it in a block and make sure the block is present everywhere you want the code to go. But I would try to put it in the right spot if possible. :)
Comment #12
dflitner commentedThank you so much vosechu. Adding your code to a js file in the theme worked great.
Now to try integrating the "You Are Here" marker along with auto location update.
Comment #13
Anonymous (not verified) commented@vosechu - awesome code. thank you!
Comment #14
shaneonabike commentedThis is fantastic!!
**Note**: You just need to remember to change the ID from
'auto1map'to the ID for your gmap :)Comment #15
GBain22 commentedDid anyone get this working to have an addMarker to the current location? I can't seem to work it out!
Cheers,
Garry.
Comment #16
ashutosh1629 commentedThanks team.
#8 worked for me too.