Closed (fixed)
Project:
GMap Module
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Nov 2007 at 12:26 UTC
Updated:
8 Dec 2009 at 19:25 UTC
Jump to comment: Most recent file
Comments
Comment #1
Michael Hofmockel commentedThe auto zoom function is great when you have more than one location to map. But when there is only on point, the auto zoom drills down too far.
The auto zoom is hard coded to "true" in gmap_location.
I set to false but then the map did not have a center.
So I added the lat/long values as the center.
I've patched my file so line numbers may be off but close.
around line 630
gmap_location.module,v 1.26.2.45 2007/11/08 22:22:11 bdragon
attached is my version.
or you can see my changes of the tail of the "function gmap_location_block_view" below.
Comment #2
hedac commentedthank you mhofmockel !
That solved the problem. I didn't realize that it started to happen when I turned on the autozoom
it's very nice now
Comment #3
mgmeskill commentedThis helped me a ton - I wonder if this will be adjustable through the admin interface at some point?
Comment #4
Zoologie.de commentedWhile the autozoom worked fine out of the box in Firefox, it didn't in IE.. that solved it. thanks
Comment #5
sopia commentedI uploaded this new file, cleared views cache, and ran update.php. Still having the same problem. No zoom, no control, and zoomed way in on location block. I also turned off autozoom. map/node comes out fine.
Did I miss something? Could someone share the map code you use for the location block? Maybe that's it?
Comment #6
hedac commentedtry setting autozoom off... or use mhofmockel code above
Comment #7
sopia commentedThanks, I did both, and still no luck :( I'll let you guys know if I ever figure it out, you do the same, please.
Happy coding everybody!
Comment #8
summit commentedHi,
I still also have the problem that the gmap_location module sooms out in too much detail. To maximum level.
I changed code like stated on: http://drupal.org/node/191223#comment-642765
So autozoom is still on I pressume?
When I edit a node I see the right MAP:
But when I view the node I see the following script. Notice the Zoom: 15!!
This is driving me nuts.. Does anybody have a solution please?
Thanks in advance!
greetings,
Martijn
Comment #9
summit commentedHi,
I found my problem!
It was an other module which did this the Gmap macro calling. And in that module the zoom level was set to 15.
Sorry to bother you.
Greetings,
Martijn
Comment #10
hedac commentedin gmap_location.module,v 1.26.2.52 2007/12/29
is in line 673
just change to false and add the latitude and longitude:
Comment #11
sopia commentedThis isn't working for me. Anybody have any luck?
Still can't zoom it out.
Comment #12
sopia commentedStill can't get it to work :( Anybody having any luck?
Comment #13
Bill.Roehl commentedI had to do this:
Because there was not even a control on the map regardless of what GMap setting I chose. This made it work sorta like the way it used to at least.
Comment #14
chaloalvarezj commentedGmap version = "5.x-1.0-alpha1"
/* $Id: gmap_location.module,v 1.26.2.52 2007/12/29 01:02:55 bdragon Exp $ */
Function: gmap_location_block_view($nid)
To get Control to display, had to comment lines 674 and 675:
Before
After:
This lines were overriding the macro settings.
Hope this has been solve on the next versions...
Comment #15
caprenter commentedJust a thank you. This worked for me.
Comment #16
Bill.Roehl commentedchaloalvarezj,
Sweet, that's a much better solution. Thanks!
Comment #17
smitty commentedWhile deliberating on the question, why the code in the function gmap_location_block_view is like it is, I found two reasons:
Default values are a very good thing, but here they are set after the macros are interpreted. So if in a macro a value is provided, it will be overwritten. The solution could be to check, if the macro has provided a value and only to set the default values if it hasn’t.
On the other hand the “autozoom” is only needed to fit several markers into the block, if the node has several locations (well, perhaps there may be a better solution to fit the markers in, but I am not experienced with this). If it hasn’t, it is not necessary to overwrite the value provided by the macro.
So I came to the following code:
Note: I didn’t put the “autozoom” in the $map['behavior']['autozoom'] as in the original code but in the $map['autozoom'] because I saw, that the function gmap_parse_macro($macro) provides this value in $map['autozoom']. I can’t figure out, if this is a bug in the original code or in the function gmap_parse_macro().
Would this be a common solution we could put into the head?
Comment #18
sopia commentedOK, I'll give it a shot. Where exactly did you place this code?
Thanks!
Comment #19
sethcohn commentedIdeally, there should be a setting to allow autozoom, BUT to also set a maximum zoom level. In other words, autozoom but do not zoom past this level, even if only one item (or even 2 or 3 items) is present.
Perhaps the solution is to tweak gmap_marker.js and adjust this:
If we set the BoundZoomLevel there, won't that fix it?
Comment #20
sethcohn commentedAfter playing with this, the answer is yes, we need to adjust that last line:
Try this (as example):
That will set the zoom to 5 clicks higher up than the 'normal' results. So ideally, we break it out into this [pseudocode]:
Someone want to write a patch? My javascript is too rusty, and ideally, the MaxZoom should be a new gmap setting.
Comment #21
smitty commented@sopia: Sorry, I forgot to mention: This snippet replaces the lines 663 - 678 in the gmap_location.module of 5.x-1.0-alpha1.
Comment #22
cglusky commentedOK, so I had the same problem but may have found a simpler solution to getting the block macro to work like node and user map macros. I left the comments in but this is how the issue of defaults is handled in the other functions in the module.
/* $Id: gmap_location.module,v 1.26.2.54 2007/12/30 16:21:45 bdragon Exp $ */
lines 682-702
I deleted all macro info in the block configuration and it seems to pick up the gmap defaults just fine. If this tests well I would also suggest that the help text in the block configuration be changed so that users know if nothing is input the gmap defaults will be used.
No idea how to roll a patch - sorry.
Comment #23
cglusky commentedand of course i am assuming that by properly picking up the gmap global defaults and or the macro info in the block config we fix this issue. also changing to CNR and including a patch file.
Comment #24
cglusky commentedlooks like the defualt values are also set when the form array is configured. starting around lines 568. new to this so not sure id setting default is required. may be another place where we can use the gmap_defaults() to get more consistent results?
Comment #25
akahn commentedJust curious, bdragon, is this functionality (the location map block respecting the macro entered on its configure page) going to make it into the next dev release of gmap.module? Thanks!
Comment #26
cglusky commentedI'll have a new patch up shortly that will be over here:
http://drupal.org/node/223588
it does respect your macro settings but my solution of merging the arrays with defaults may not be how bdragon et al want to handle it.
and my patch is only working if you are not using google's marker manager. have not tested it with cluster.js but it works fine if you select "None" for marker manager in the GMap admin. I'll submit this last as a separate bug.
Comment #27
akahn commentedcglusky, thanks for taking this up. What, exactly, is a marker manager? Each of my location nodes will only have one location, but they will be viewed all on one map via a view occasionally. Do I need to worry about marker managers?
Cheers,
Alex
Comment #28
cglusky commentedalex,
alas, not an expert in marker managers. i do know they help with the display of multiple markers on a map. you can help declutter at certain zooms and cluster nodes when it makes sense. overalll helps with performance and UI.
But I think it's a valid question: When do I need to start using a Marker Manager? Is there a rule of thumb number of nodes/markers per map? Don't know and have not searched around here for the answer. I bet it's been asked before so if you find out let me know. Sorry no time today.
I just uploaded my latest patch here:
http://drupal.org/node/223588
r,
Coby
Comment #29
edg commentedsubscribing
Comment #30
bdragon commentedThe next snapshot will have a "maximum initial zoom" setting, which autozoom will honor.
Comment #31
bascostbudde commentedSubscribing.
Risking to overlook the obvious: I cannot find where the zoom state during marker entry is saved. My nodes will have one marker, so in my case there is indeed a "the" state of the zoom. Has anyone implemented this?
edit: Yes, GMap addons. gmap_cck does what I want.
Comment #32
marcoBauli commentedfor the moment solution at #10 works here, thanks! (subscribing)
Comment #33
bdragon commentedYou can use something like
|maxzoom=10in the macro to limit how far it will zoom in, or you can change the defaults on the gmap settings page.Comment #34
bartezz commentedsubscribing