This one is part of META issue #1931138: Fixing all 'single marker' issues
Today I've been trying out marker managers to do some clustering on a map I'm using, and I've run into a problem. I've tried using both Jef Poskanzer's Clusterer and Martin Pearman's ClusterMarker, and when I set the cluster icon to be anything (other than Default for Clusterer), the path to the icon image for cluster markers is wrong.
Looking at the requests in my browser, the problem seems to be that the path being constructed to the cluster icon image is not taking into account the basePath for my Drupal install.
My site's front page: http://mysite.com/subsite/
Path to icon for clusters: http://mysite.com/sites/all/modules/gmap/markers/cluster.png
The "subsite/" part isn't making it into the URL for the icon image.
The markers for my non-clustered map items are coming up just fine, which means I'm pretty sure that this is a problem somewhere in the marker manager code. And since it's happening on 2 different marker managers, I figure it must not be specific to which manager I'm using.
I've been looking through the code to try to figure out where the path to these icons gets constructed, but no luck so far. Any pointers or fixes?
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#17 | gmap_marker_js_fix-1218870.diff | 476 bytes | reeller_sk |
#7 | fix-marker-managers-base-url.patch | 1.17 KB | hadim |
#1 | marker_path-1218870-1.patch | 388 bytes | idflood |
Comments
Comment #1
idflood CreditAttribution: idflood commentedI had the same issue on 7.x-1.x. I've found that the gmap_regenerate_markers function use base_path() but this is not defined yet. The trick is to call drupal_bootrap before using this. On drupal 6 I bet you should have to call conf_init().
Here is a patch for the 7.x-1.x branch.
Comment #2
idflood CreditAttribution: idflood commentedComment #3
smyle-1 CreditAttribution: smyle-1 commentedI have the same issue but the fix is not working for me.
I have tried other things, notably from: http://drupal.org/node/910482
* Change base url in settings.php: $base_url = 'http://mysite/var/www/mysitedirectory/';
--> break the whole site ;
* Hard code the base url in gmap_regenerate_markers:
iconpath in gmap_markers.js is changed to : "http://mysite/var/www/mysitedirectory/sites/all/modules/gmap/markers"
but I still cannot see my markers on the map.
Has someone managed to resolve this issue?
What directory should I see in gmap_markers.js?
Everything else is working correctly on the map, so I suppose accessing the marker image is the issue, but is there a way to check the problem is not somewhere else?
Thanks in advance for your help !
Comment #4
hadim CreditAttribution: hadim commentedSame issue here !
Comment #5
hadim CreditAttribution: hadim commentedI find a way which works for my installation. In gmap.module in function gmap_regenerate_markers():
Add
global $base_url;
athe beginning of the function.$contents .= "Drupal.gmap.iconpath = " . drupal_json_encode(base_path() . variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') . '/markers')) . ";\n";
by
$contents .= "Drupal.gmap.iconpath = " . str_replace(".", "\/", drupal_json_encode($base_url . "/" . variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') . '/markers'))) . ";\n";
The thing is, I am using multi site installation so my site subfolder match with my url. After that I just replace "." by "\/".
I don't think this is the cleanest way to resolve this bug but it's actually working :-)
Comment #6
hadim CreditAttribution: hadim commentedI generated a patch according to my last post :
Comment #7
hadim CreditAttribution: hadim commentedComment #8
haiiro.shimeji CreditAttribution: haiiro.shimeji commentedSorry, I cannot get the same problem.
Jef Poskanzer's Clusterer works fine with current 7.x-1.x branch, though my drupal is installed in a sub diredtory.
@hadim 's patch seems to assume that base_path() returns the wrong path..
What does base_url() return in your environment?
Comment #9
hbalagtas CreditAttribution: hbalagtas commentedI'm also experiencing the same issue, but only after I transferred the site to the development server from my local environment. @hadim the patch didn't work with my setup.
Comment #10
podarok#7
needs reroll against latest head
Comment #11
johnvI wonder if this also works if you have multiple subsites, that generate different files, since they are all saved as 'public://js/gmap_markers.js', overwriting eachother.
On a side note: in admin/config/services/gmap, you are instructed to move the file in case the file system is set to 'private'. Does that generate side effects?
Comment #12
podarokpossibly we should do inline drupal_add_js inclusion for that kind of configurations
todo?
Comment #13
podarokbot
Comment #15
podarokthis one needs reroll
anyone can help with this issue?
This is the last one critical before 7.x-2.5-beta1 release
Comment #16
johnvThere are a lot of related issues for this problem.
This issue should resolve both the creation and the inclusion of markers.js.
(a variant of ) Below code snippet must be included in the patch:
Comment #17
reeller_sk CreditAttribution: reeller_sk commentedHere is the patch from #1946494: module calls gmap_marker.js but it doesn't exist duplicated thread .
It contains the snippet on new codebase.
Comment #18
podaroklets bump it to bot
Comment #19
johnv#7 and #17 need to be merged.
Comment #20
johnvMarked #1098030: Map markers do not display on node view when site is in a subdirectory as duplicate.
Comment #21
cjamesrun CreditAttribution: cjamesrun commented#17 worked for 7.x-2.6 installed in the last day or so.
Marker was not showing up. Drupal was installed on a subfolder, and it was looking for it from the root in root/sites/... instead of root/subfolder/sites/....
Thank you
Comment #22
dimitrov.adrian CreditAttribution: dimitrov.adrian commented#17 Patch is working. +1 for merging.
Comment #23
green_eye55 CreditAttribution: green_eye55 commentedGreat! #17 worked for me in a subfolder installation.
Thank you! I have spend hours on this issue.
Comment #24
johnvDoes any one of you (with sites in subfolders) use custom markers. IMO you should need #7, too - not only #17.
Comment #25
dimitrov.adrian CreditAttribution: dimitrov.adrian commented@johnv actually i am testing my stuffs on d7 installed in subdir and not need from #17, only #7
Comment #26
drtrueblue CreditAttribution: drtrueblue commented#17 also worked well for 7.x-2.6. Thank you for the support. Perhaps this is easily answered, but will this change eventually get put into place for any future versions or will I have to regularly apply the patch?
Comment #27
hstreitzig CreditAttribution: hstreitzig commentedAfter updating to 7.x-2.6 i have lost the markers on different maps. #17 helped to fix this problem. Thanks!
Comment #28
podarok#17 commited pushed to 7.x-2.x
tagged 7.x-2.7-beta1 release
let`s follow up and see for possible #24 tip in production
If any have bug described and fixed in #7 feel free to reopen and reroll ot against latest dev
Thanks to all!!!
Comment #29
crutch CreditAttribution: crutch commented#16 fixed for me
Comment #31
jessicakoh CreditAttribution: jessicakoh commentedI fixed mine by putting "gmap_marker.js" on js folder in gmap module.
Comment #31.0
jessicakoh CreditAttribution: jessicakoh commentedUpdated issue summary.