Using gmap module we can build a macro to display user locations and node locations by making settings on this page administer/settings/gmap_location.
But if creating a gmap view using the views module, where can set a customized gmap macro? I want to create a number of gmap views for diffrent group of locations. Would it be possible to set different gmap macro for each view map?
Comments
Comment #1
merlinofchaos commentedIt would be up to the gmap module to support something like that and giving Views the necessary information to run with it.
Comment #2
bobo commentedAgreed, this is quite important. I would like to do this also. How else do I view only one set of nodes under a certain taxonomy on a map that I decide the size and location of?
Comment #3
lennart commentedthis could be extremely useful
Comment #4
lennart commentedmaybe the default view could be set to something else than 'GMap' and then when 'GMap' is choosen from the roll down menu in views and extra input field is loaded just under the roll down many.
In this extra field the admin can insert the macro that is created in the usual way.
Comment #5
lennart commentedastra - I see you have assigned this to yourself. Are you working on a patch? I am very interested in this functionality.
Comment #6
astra commentedNo. I am waiting for somebody else who can make a patch to support it.
Comment #7
lennart commentedAh, really? Then I think it would be better not to assign it to yourself. This way people will think there is no need to work on it because you already are.
Comment #8
astra commentedOkay, change to "Unassign", hope somebody can work on it.
Comment #9
abegg.ch commentedI worked it out the following (dirty ?) hack:
The original line was:
$thismap = array('id' => 'view_gmap', 'markers' => $markers);$view->macro = "[gmap |center=47, 8 |zoom=11 |width=300px |height=200px |control=Small |type=Map]";Seems to work quite well. I'am thinking of passing a node-id as argument and then retrieve the macro-string from a specific field of that node to make gmap-views creation more dynamic.
Comment #10
abegg.ch commentedsorry, changed title accidently
Comment #11
lennart commentedgreat! good work!
Comment #12
astra commentedThank you abegg! I used you code to replace that line (the line 1250 of gmap module v. 1.49) and it works quite well. That is what I want. Really fantastic!
Comment #13
jredding commentedShould this be something that is rolled into a patch and made part of the gmap-views integration piece?
Comment #14
bdragon commentedYeah, I recently learned how the hack works, and I need this really bad too.
I'll implement it now, thanks for the pointers.
Comment #15
bdragon commentedI asked merlinofchaos in IRC and he says this is the way to do it at the moment...
Committed change to allow setting $view->gmap_macro.
Thanks!
--Brandon
Comment #16
jonnyz commentedHi. I'm using gmap 5.x-1.x-dev. Can I apply the hack against that? I did not find the code to replace. I tried adding the argument handling code without changing any of the source but that didn't work either. Probably just my ignorance as to which version of the code you guys are working from.
Thanks,
JZ
Comment #17
bdragon commentedIt's already applied. Note that I used $view->gmap_macro, not $view->macro.
Comment #18
jonnyz commentedworked! thank you!
Comment #19
shunting commentedBump
Comment #20
(not verified) commentedComment #21
najibx commentedSince we can views argument handling in such a way,any suggestion so we could retrieve the macro-string from a specific field of a term and make gmap-views creation more dynamic for specific views? We can add the latitude/longitude, zoom level in the term - http://drupal.org/project/taxonomy_fields
Comment #22
bdragon commentedPlease open a seperate issue.
Comment #23
najibx commentedOK. Posted it here. http://drupal.org/node/310532
Comment #24
carpintero commentedi am able to insert the following code into the "argument handling code" area of my gmap view, and it works:
but what i want to do is have the center be dynamic. so i made this code, which finds the latitude and longitude of this node.
i have tested that in the body of the node and i know it works.
so i would think the following code, placed into the "argument handling" section (without the php tags) *should* work. but it doesn't:
any suggestions? thanks! (drupal 5.7, gmap 5.x-1.x-dev)
Comment #25
ahkiam commentedI use "|behavior=+views_autocenter" in my gmap macro code to get centering on the nid lat/long.
Comment #26
jrb207 commentedIt seems that adding a Gmap Macro to a view by including the following code in the Argument Handling Code field is working for most commenters in this thread.
$view->gmap_macro = "[gmap zoom=15 |center=44.10342701164543,-69.10378932952881 |width=100% |height=450px |control=Small |type=Map]";I'm not able to make this work with our current Drupal/Gmap versions. (Drupal 5.1 + map - 5.x-1.1-rc1)
http://www.maineboats.com/maine-coastal-directory/harbor/rockland
You'll note from the code above that we are trying to zoom into a specific level and center point with this view but it still defaults to the Gmap Location settings. Since we want to create several maps throughout the site I need to be able to change the settings within each view.
Any suggestions would be greatly appreciated. Thanks.
Comment #27
jrb207 commentedI discovered the issue. I had AutoZoom checked in the Gmap settings. Since we wanted that enabled for some maps but not for others we were able to override the setting by adding |behavior=+override_autozoom at the end of the gmap macro, within the Argument Handling Code field.
Comment #28
podarokrelease unsupported
feel free to open issue against latest 7.x dev