Hello,
I'm using gmap with a view of locations. This view has an exposed "Location: Distance / Proximity" filter that the user can use to find locations near her. Attached is a patch to the gmap_plugin_style_gmap.inc which adds an option "Center on proximity filter" (very similar to the "Center on node argument" option) to cause the center of the map to be where the user is searching.
I'm a little confused about the relationship between the 'gmap' module which provides the views style plugin and the 'location' module, because 'gmap' doesn't actually depend on 'location'. So, I tried to wrap my changes with checks for the 'location' module, but I may not have gotten it right.
Please let me know what you think!
Thanks,
David.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | gmap_relative_proximity.diff | 2.63 KB | aj2 |
| #12 | 1235932-8.patch | 2.31 KB | podarok |
| #10 | 1235932.patch | 4.84 KB | podarok |
| #9 | Proximity-centering-for-gmapextended.patch | 4.5 KB | Johnny vd Laar |
| #8 | gmap-add_centre_on_views_arg-1235932-8.patch | 2.24 KB | heylookalive |
Comments
Comment #1
Clint Eagar commentedWorks great. One suggestion, also add a zoom feature. So that when a user searches it not only centers on their search but also zooms.
Comment #2
dsnopekHrm. Where should it get the zoom value from? This patch basically just copies the latitude/longitude from the filter to be used to center the map. It has no zoom value to copy.
If you're looking for something that automatically centers/zooms so that all the points fit, the gmap module already has that. On the configuration page, select the "autozoom" behavior.
Unfortunately, these two features "conflict" in the sense that "autozoom" will change the center from whatever this patch sets it to. But I think they are for different use cases. This patch is if you want the center to be on what was searched for and "autozoom" is for if you want the center in the middle of the data points.
Hope that helps!
Regards,
David.
Comment #3
Johnny vd Laar commentedThe attached patch works in the drupal 7 version.
Comment #4
Anonymous (not verified) commentedpatch in post #1 works on drupal 6... amazing work, people!
Comment #5
dimon00 commentedVery useful, thank you.
Comment #6
gazwal commentedadds an option "Center on proximity filter" (very similar to the "Center on node argument" option) to cause the center of the map to be where the user is searching.
screen exemple below
Comment #7
Frederic wbase commentedi've tested the patch for D7 on the latest dev and it works like a charm! Nice job and thanks for the hard work :-)!
Comment #8
heylookalive commentedHi @dsnopek, @Johnny vd Laar great stuff!
I needed this but for views 3 contextual filters/arguments so here's a patch.
Note this is Drupal 7, and does not rely upon the previous patches (will work without the filter patches).
Comment #9
Johnny vd Laar commentedThis patch attaches the same functionality for gmapextended
Comment #10
podarok#9 rerolled agaist latest head
commited / pushed to 7.x-2.x
thanks!
Comment #11
podarokthe same pushed to 7.x-1.x branch
thanks!
Comment #12
podarok#8
removed whitespaces
commited to 7.x-2.x and 7.x-1.x
thanks!!
Comment #13.0
(not verified) commentedFixed some type-o's.
Comment #14
asad.hasan commentedWhat patch works for d6? @Careless post #1 has no patch.
Comment #15
aj2 commentedIt appears that the "relative" center on proximity patch is missing. I copied the code from the gmap extended patch #9 to get working. Otherwise the map is centered on proximity without any local markers. Patch included.