Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By Havamal on
I've installed GMAP, Location, CCK, and Views to create a basic form for tracking points across the global. I'll be creating separate views by country region. Right now, the Google Map that displays in the page view goes to the default setting. Is there a way to have this change dynamically, and/or how do I create a separate center point for each view?
Comments
Figured Out
Nevermind. No sooner than I posted than it hit me I can edit the macro directly in the view admin page. It's not a dynamic center and zoom, but still possible to deal with it.
Change default Google Map Views for different views
A couple options I've found:
1) Similar to above:
a) Figure out the default settings that you want. I did this by using "build a GMap macro" and getting the map looking exactly like I wanted.
b) Then, in "build a Gmap macro", I went to the bottom and copied the macro text.
c) I then went to views > style options (next to Style: Gmap) > Macro and pasted the above in there.
This is static, not dynamic.
2) In Admin > Site Configuration > Gmap in the Map Behavior flags set autozoom to on. This will require that the view only selects the nodes you want to display.
Automatically center and zoom map to fit markers
PeterZ, thanks for posting the above message. I was able to get my GMap that is built using a view to center and zoom automatically to fit the node locations using your #2 option. Just go to Admin > Site Configuration > Gmap and make sure you turn autozoom on. It worked great for what I needed. Thanks!
Thanks for option 2! Couldn't
Thanks for option 2! Couldn't find it untill you wrote it down!