My D7 website has events that are categorized using taxonomy. I'm trying to use OpenLayers to show the events on a map. I got that part working. But, I want to color-code the pushpins according to the taxonomy (e.g., Farmer's Markets, Children Events, Art Events, etc).
I see other questions from people needing to do this but I haven't found an answer that I can understand.
I found the following in drupal.org but I can't figure out what they're trying to say:
"Add an image field to your taxonomy vocabulary. Then, in your OpenLayers style settings, use the curly bracket format for loading the image associated with each term as the map point icon. I know this isn't a detailed description of how this works - but play with it. It's totally doable with some configuration work."
I added an image to the taxonomy but I can't figure out the next step. The OpenLayers Style tab just has options to Export and Clone and that doesn't seem to help.
They may be thinking of a section in the view's "OpenLayers Data Overlay:Style options" called "Attributes and Styling" that lists things that have curly braces. It says "these can be placed right in the style interface" but where is that? If they're talking about PHP, does anyone know which PHP file I'm supposed to edit? I can handle a simple Select/case statement if that's what they're referring to.
I also found the following but get stuck at the part about creating "new display types".
Definitely a way to color-code based on views. You set up a page display, give it an "OpenLayers Map" style. Then you create new display types called "OpenLayers Data" - each of these correspond with the "Layers" tab in OpenLayers (admin/build/openlayers/layers). You can change the style of the icon/pushpin that appears on the map in the Styles tab (admin/build/openlayers/styles).
I'm using Location module, MapBox, Views, and OpenLayers for my particular cocktail..
Has anyone done this who can point me in the right direction? (I was kinda hoping/expecting that I could use my contextual filters for this but I haven't read anything along those lines.)
By the way, my Geofield data is wrong and I haven't found any other similar reports (it's Geofielding events that don't have the AddressField set up, which are overlaying valid events). I think it's a problem with the cleanup when I switched from allowing multiple Geofields back to single Geofields. If this happens on the live site, I'll be heading to Sagetree with a chocolate cake.
Thanks.
Debbie
Comments
I think this can be done much simpler
[It's been a while since I played with OpenLayer, and I am shooting from the hip here, so take this with a grain of salt.]
Remember that it's OpenLayers (plural). You can add as many views / layers as you need, and color the markers differently for each one. So, build a view (actually two, but you know that part already) for each taxonomy term, pull them into OpenLayers, and then define the marker style for each.
--
Christoph Weber
Tried that but worth trying again
Christoph,
I tried once and couldn't figure out how to do it. But, I'll give it another shot. I suspect that I may need to write some code, anyway, to let the user select which layers they want to see so it looks like I'm going to have to take this to the next level, anyway.
I already have over 350 active nodes that are using the old Location fields. I can't automate the migration to AddressFields (for at least 2 reasons that I won't go into here) so I'm spending hours copying and pasting. I'll dive into the PHP, Javascript, or whatever I need to do after that I finish this delightful copy-and-paste exercise.
I have an idea for something else but it's a different topic so I'll open up a new discussion. But, you're the person I have in mind.
Debbie
More on OpenLayers
Christoph, I figured out how to add those multiple layers. Sooo simple once you know where to look. Now, I'm almost within reach of the finish line and I'm stumped again.
The default popup window is now dark gray (I think it used to be a sane white). So, the titles appear as blue on dark gray and are barely legible. I can't imagine anyone living with that, which means everyone has to change the color but I can't find any instructions.
I've spent hours today fiddling with CSS but to no avail. Then I read somewhere that the trick is to change the actual png file that is used. Amazingly enough, that had no effect. And, yes, I flushed the cache...twice. I've tried IRC but nobody is replying. And, I've reopened an issue where someone else asked the same question and got the all-too-typical cryptic reply ("You have to theme it". "Yeah, thanks, I got that. Would you please be a little more descriptive?")
Does anyone here know how to change that [ridiculous] background color?
[Update: Mystery solved. That png file was being stored in my browser's cache so flushing the site cache had not effect at all. I've opened a bug report requesting that that png file not be cached for longer than a few minutes. Otherwise, since people are changing the color of that png file to get around the blue on dark gray problem, who knows what color the user's browser will serve up for that png?]
Debbie