Posted by redmood on October 2, 2007 at 11:39pm
Jump to:
| Project: | GMap Module |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I think it will be very usefull to define pins (markers) based on taxonomy.
My problem is that that i have PLACEs and i've defined 4 or more TYPE of places (using taxonomy).
If i tray to display a map using feeds it doesn't show different makers (even if i specify them) see my support request at http://drupal.org/node/180332
The only way i can use now is to specify different content types, one for every TYPE of PLACE and to assign to every TYPE a different marker using gmap location settings. The problem that still remain is that when i click on a marker the info window appears only for a second and then the page is redirected to the node page.
Comments
#1
This can be done using the views and views bonus modules -- create a gmap view and you can filter on whatever categories you need.
#2
What would be nice is to define different markers per taxonomy term. I don't believe this is possible right?
#3
Per taxonomy term? I don't believe so.
Per content type is already supported via the UI --
With that said, it would *probably* be possible to get different markers per taxonomy term through a function in the template.php file -- If I was going to attempt this, this is probably where I'd start --
However, creating multiple maps (accessible via tabs), with each map showing items in a specific taxonomy, can be done using the existing functionality of the views module.
#4
Just subscribing saying that this would be an excellent feature.
#5
Yes i was talking about diplaying different markers based on taxonomy terms.
Look at this situation: you have a type of content called BULDING, you need to categorize it by TYPEs of buildings, so, by now, i think the only way is to create different types of BULDINGs using content_types , one for every TYPE, so you can specify a marker for every content type into gmap module settings. But if you need a lot of TYPES this will be huge work of profiling.
In these days i need to do something like that, so i had to modify manually (maybe in the wrong way) the gmap_views.module to show different markers based on a field from taxonomy used in my gmap view (in this case the field is labeled "tipo"). This is the code, but i know this is "hard coded" and maybe this is not the right way to do that, but was the only way for me, just approched to drupal.
In the function theme_views_view_gmap i added this code to define $custom_marker based on my view field labeled "tipo" and the used $custom_marker to set the $markername
// FIX BY MAGNUM - molinari@redmood.it
$fields = _views_get_fields();
$custom_marker = "ispro generic";
foreach ($view->field as $field) {
$tipo = "";
if ($field['label'] == 'tipo') $tipo = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $entry, $view);
$tipo = strtolower($tipo);
if ( substr_count($tipo, "c.r.i.") >0 ) $custom_marker ="ispro cri";
if ( substr_count($tipo, "capitaneria") >0 ) $custom_marker ="ispro porto";
if ( substr_count($tipo, "armate") >0 ) $custom_marker ="ispro fa";
if ( substr_count($tipo, "regioni") >0 ) $custom_marker ="ispro dpc";
if ( substr_count($tipo, "sanit") >0 ) $custom_marker ="ispro asl";
if ( substr_count($tipo, "fuoco") >0 ) $custom_marker ="ispro vvf";
if ( substr_count($tipo, "protezione") >0 ) $custom_marker ="ispro pc";
};
$markername = variable_get('gmap_node_marker_'. $type, '');
if ($custom_marker != "") $markername = $custom_marker;
any suggestion or modification og gmap module or addons in progress ?
#6
#7
Any reason why this was closed?
I need this functionality and am happy to spend a bit of time turning this into a patch or perhaps a contributed module. I've never done this before, so I'd need some help. Is anyone interested? Does the above code seem the most sensible place to start?
Eventually I would like to have it set up so that all taxonomies are listed down the side with check boxes allowing each taxonomy to be turned on or off, but this is a long way off!
My model is something like http://www.groenekaartkrommerijn.nl/
#8
Subscribe.
#9
Subscribe
#10
Hmm, I just realized it would be possible to do this relatively efficiently by maintaining a side table of nids and markers and updating it by implementing nodeapi.... And it's possible to keep a side table on taxonomy terms...
Hmm, interesting idea...
#11
Well, I went ahead and did it.
http://drupal.org/cvs?commit=93197
#12
Duplicates marked.
http://drupal.org/node/113623
http://drupal.org/node/173776
#13
Excellent work! I'm looking forward to testing this sometime soon.
#14
I just added support for the taxonomy markers to a) the location block, and b) gmap_views.
Note that to use gmap_taxonomy, you have to:
1) Edit a vocabulary and enable the GMap Markers option.
2) Edit terms in that vocabulary and assign markers.
3) Edit and resave any nodes already tagged (It only associates a marker with a node during node save.)
#15
Seems to be working well.
Having to re-submit the node to change the marker is a bit inconvenient, but if custom markers are created then either the .ini file or the .pngs themselves can be altered instead of having to re-submit every node.
#16
There is this module called taxonomy_image, would it be possible to use those images if the module is installed (not making the module an requirement for gmap_location, but just an optional integration)?
Anyway, using taxonomies in any way is better than having to go by content types, though going by content types makes it possible to use the relativity module to enforce some rules.
#17
By the way, you no longer have to resave nodes, the latest version should stay consistent in all cases now.
#18
The latest dev version is working well for me. I was able to change the GMap Marker field on the taxonomy term edit page, and all relevant markers were updated on the gmap view. thanks!
#19
thanks for the add, trying to use my own markers, a comment line in gmap_markerinfo.inc says:
// The following routines are designed to be easy to comprehend, not fast.
// This whole process gets cached.
how can i disable caching and generally upload my new set of markers ? i've uploaded in the /markers subdir the same directory i used in the previous version of the module, but i cannot see them in the list of avalaible markers when i try to specify the marker in each term of my vocabulary...
#20
I'm not sure about how to disable the caching, but if you go to /admin/build/modules on your site and re-submit that page, it should clear the modules' cache and allow the new marker images to show up in the marker image select box on your term pages. (As a side note, the devel module also provides methods for clearing the site's cache.)
#21
i cannot add custom markers: i add my .ini tried in /markers and in /markers/mydir i tryed modifying existing .INIs but nothing, nothign chages in my taxonomy term edit page, someone can help ?
#22
You need to clear the cache. Easiest way is to install the Devel module (http://drupal.org/project/devel) and enable the devel block (only for Admins). This block has a 'clear cache' link. This worked for me when adding new markers. Good luck!
#23
just tried thanks ! :-)
#24
Changing status to fixed. Glad it worked!
#25
Automatically closed -- issue fixed for two weeks with no activity.
#26
This was working perfectly until I was forced to install some 'updated' modules-have not been able to get this to work since updating to Views 2. I have tried all the suggestions above and quit a few more since I have been working on this intermittently for several months now. I just finished attempting it again by deleting my location content type and the corresponding taxonomy type, reinstalling and starting again. Still doesn't work! There MUST be some setting somewhere!!! Why did you change it? I really could use some help. Still haven't be fired despite looking really incompetent.