Active
Project:
GMap Module
Version:
7.x-2.11
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Feb 2012 at 21:00 UTC
Updated:
17 Feb 2017 at 17:26 UTC
Jump to comment: Most recent
I'm creating a gmap view to display the locations of three different content types and I'd like each content type to display as a different color marker. I've selected the 'by content type' option under Marker handling and set a default marker color. Each location field in each of the content types has a different marker color selected. But the map is only displaying the default marker set in the view. What's the trick to get multiple marker colors based on node type?
Comments
Comment #1
n20 commentedIm looking for the same functionality. Did you figured out how to solve this?
Comment #2
russellb commentedI'm also looking at this. Did anyone get this working?
I'm using a location field rather than the old node locations, my guess is that this only works with the old node locations system, not the new fields verison
I can see the colours displaying on the inline map for the field, but not on the view where I want to see different colours for different content types.
Comment #3
russellb commentedI've investigated further on this.
The gmap views plugin is looking for a variable 'gmap_node_markers' which should store the the marker for each content type for this functionality to work. I didn't have anything in that variable using fields based locations. I can get the coloured markers working by setting data in that variable manually eg.
variable_set('gmap_node_markers', array('event'=>'blue', 'stakeholder'=>'purple'));
I guess the ideal here would be for the views plugin to support retrieval of marker type from the field setting directly, rather than go via this variable.
Comment #4
russellb commentedComment #5
rickgadbois commentedNew to drupal, please pardon.
In what directory/file would I make the change suggested in russelb #4?
"variable_set('gmap_node_markers', array('event'=>'blue', 'stakeholder'=>'purple'));
"
Comment #6
russellb commentedA simple way of trying this out might be to use the devel module to execute some php, and paste your variable set command in there, replacing my 'event' and 'stakeholder' with your content types.
Another way would be to create a custom module which would set this variable, perhaps alongside any other customisation that you wanted to do to location / gmap. In this case you could create an install file for your module, and use a function like this:
Comment #7
russellb commentedI'm still needing to update this variable manually on gmap 2.11.
It looks to me like there's an old D6 hook implementation left over in gmap D7.
gmap_location.module line 934:
I don't think hook node type exists any more in D7.
Additionally I assume that the code here was designed to work with node locations, rather than location cck.
Comment #8
russellb commentedComment #9
noobcarlos commentedHi, When i put different markers for the content types ( only two ), the map´s views only display three nodes.
Content type 1--> Red
content type 2--> blue
Content Type 3--> green.
But there are 15 nodes. However, If I use the same marker, drupal displays all the nodes.
Can anybody help me?
Sorry for my English!
Comment #10
noobcarlos commentedI use a views with different content type. I want use a different marker each node type. But when i have configured this, the map only display three nodes. However i use the same marker for all types display all correctly.
I need help! Thanks and sorry for my english!