Active
Project:
GMap Module
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2009 at 15:13 UTC
Updated:
19 Sep 2013 at 10:25 UTC
Jump to comment: Most recent file
Comments
Comment #1
tom_o_t commentedThe solution I came up with for http://www.opengreenmap.org/en/greenmap was to use http://drupal.org/project/taxonomy_image
It's not a great solution as you have to duplicate the image used for the icon - once for gmap taxonomy markers, and once for taxonomy_image. But for me that worked well because I wanted different versions of the icons for the key and map anyway. You can create a block containing the taxonomy images with a bit of coding. I did a bunch of custom stuff using jquery to create a collapsible hierarchical key because there are so many different icons on the map, but for a simpler key this wouldn't be necessary.
I know that Bevan came up with a different solution for http://hub.witness.org/en/map - and I think he submitted a patch that included this. If you search around the issue queue and look for his posts you may be able to find it. It is probably closer to what you need.
Good luck - your site looks fantastic!
Comment #2
matthew_ellis24 commentedThanks, I'll give that a go. I've been thinking about it over night and I'm tempted to have a different icon for the different subgenera, which means 73 different icons in the 9 different subdivisions (ie 9 different shapes to represent the subdivisions and then different colours for the subgenera). I've not done any work with jquery but I'll have a look at that too as your key is more or less exactly what I want.
Many thanks
Matt
Comment #3
matthew_ellis24 commentedI'm struggling with this key. I can get taxonomy images to display on species node pages but not on the gmap views. Presumably this is because the species node actually calls the taxonomy terms whereas the views page doesn't.
Is it necessary to call terms with images direct from the database? I presume not because if that was the case you wouldn't need taxonomy_image as the markers are saved to term ids anyway. And I hope not as that would require some nasty joins to get the hierarchy and images out :)
Comment #4
tom_o_t commentedI created a custom block that displays next to the map
The block's content uses the taxonomy_get_tree function http://api.drupal.org/api/function/taxonomy_get_tree/5 to get an array containing the terms for the appropriate vocabulary containing the key for the terms. Then I looped through all these terms to call the appropriate image for the term (there's a function in the taxonomy image module that does this). I then cached the resulting html code to save having to do this every time.
Comment #5
matthew_ellis24 commentedah ok many thanks. This is well beyond my skills at the minute so it might be a job for the future.
Thanks very much for your help
Comment #6
matthew_ellis24 commentedHi, for the idiots like me out there I've managed to get a very basic dynamic key together. As stated above you need to install taxonomy_image and assign images again, from what I can figure it's because gmap doesn't have any function for dealing with the images.
It would probably be better/more correct to print as an unordered list. This is quite unpretty but given everyone will want to theme differently this is probably a good place to leave it. Also I can't figure out how to make it prettier just yet :) but as tom_o_t says jQuery is probably the way to go
Comment #7
matthew_ellis24 commentedI've tried adapting your script with a modicum of success. It's nearly there but I'm getting my logic all confused and things are popping out of my if loops in all the wrong places. My code is below. I know my problem is with the final bit of the elseif loop meaning that I get
</ul>or</li>or both being printed before the actual lists are printed which of course really upsets it.Any help would be greatly appreciated, especially as I can taste the end!
resulting page here
http://www.carabusonline.co.uk/content/taxonomy-tree-test
Comment #8
tom_o_t commentedHere's the code we used at Green Map. Basically I created a legend module with the display_key function in it. The function should be called with the parameter $icons, which is created using taxonomy_get_tree.
I'd love to turn this whole thing into an addon module for gmap, if there's enough interest, so I'd appreciate suggestions of improvements on how to do this. The code below is for the D5 version of the module, but I don't see anything obvious that would stop it working in D6. I've attached the code as a textfile too.
$icons = display_key(taxonomy_get_tree(1));Comment #9
matthew_ellis24 commentedah, that would have been well beyond my drupalness. But I did learn that functions are your friends and that given enough time jQuery is good at making things pretty. Thanks I'll try and get this working.
Comment #10
matthew_ellis24 commentedexcellent, this works really well. Need to play around with the theming, but that should be very easy given the very neat classes you've laid out. I also need to figure out how the checkboxes work. I thought they were linked to a url argument, but there's no argument being parsed from what I can see so not sure how to work with them. The checkboxes themselves are turning up in a slightly odd place (inline with the titles but outside of the block region) which is no doubt a theming issue as well.
It's really spot on and I hope you manage to get this together as a full module as it's exactly what gmap needs.
Thanks again
Comment #11
tom_o_t commentedI should have taken the checkboxes out of the code I gave you - they interact with some crazy custom stuff that we created - they won't work with content loaded the standard gmap way. I'd recommend stripping out the checkboxes, unless you're a real javascript genius!
Comment #12
matthew_ellis24 commentedI'm certainly not unfortunately! If you do develop this further they'd be quite handy. But as it is my hierarchical select menu is an OK way to filter them. Now to theme the key and make it look reasonably pretty. In fact the whole site could do with prettifying really. Ah, one day!
check boxes removed
Comment #13
matthew_ellis24 commentedI've tried setting this up on a sister site
http://www.phanaeinionline.co.uk/species_map
the taxonomy here is a bit different and the custom markers are on the second, not third level. This appears to upset the code! I've tried reducing the max_depth in the hopes that this would force it to display the images
Unsurprisingly that didn't work, but it did stop it trying to expand the second level terms. Obviously the problem is it's expecting parent->child->content whereas in my case the child is the content. Is this get-round-able?
Comment #14
matthew_ellis24 commentedGot it. This is an edited version of the original code and displays icons for the bottom level of a two level hierarchy. Probably less use for this than the three level hierarchy supported by the original code, but here it is:
Comment #15
matthew_ellis24 commentedremember to grant permission to "access taxonomy images" to whoever you want to be able to see them!
Comment #16
bartezz commentedsubscribe
Comment #17
mandclu commentedSubscribe
Comment #18
podarokrelease unsupported
feel free to open issue against latest 7.x dev
Comment #19
jkingsnorth commentedAdding this back as a feature request against the latest dev - some way to create an automatic legend of markers and associated taxonomy terms would be great.