Hello,
The nodes are tagged with differents terms (categories).
Is it possible to display a different marker for each taxonomy term ?
Thank you for your help.

Comments

Patroclas’s picture

I have been looking at this too. All I have thought of so far is creating different overlays by using different Views with filters and then displaying them all on the map together. I have not tried that but it may work if you don't mind all the extra overlays?

zzolo’s picture

With variable styling, you can have a different marker per Taxonomy. You just have to add a field to your Taxonomy that is the marker path, then you can bring that data into the Views Data Overaly and utilize variable styling.

Patroclas’s picture

Ah yes - fieldable entities if I am not mistaken! I am still getting to grips with those!

Thanks zzolo

zzolo’s picture

Status: Active » Closed (works as designed)

All good? If you have more questions just re-open.

Selfirian’s picture

Hi,

First off great module! Many thanks to all the developers.
I'm strugling with different markers per taxonomy term.

What I did sofar is adding a field to my taxonomy markers, marker_url, where I put the path for the marker image I want to use.
Added the field (term) Taxonomy term: Marker URL in my OpenLayers Data Overlay

Is this correct? what is the next step?

Thanks in advance!

Selfirian’s picture

Status: Closed (works as designed) » Active
ekes’s picture

Status: Active » Fixed

I've added some documentation for this: https://drupal.org/node/1585880

If you want per taxonomy term it's probably going to be easiest to add the taxonomy term field; then use the replacement it gives you in ${term_node_tid_rendered} or ${term_node_tid} in your icon file name.

I'll close this solved as part of the cleanup of the issue queue for the openlayers sprint at Drupalcon Munich. If you need more do reopen. If you have more description to add to the documentation for the taxonomy term example, please do.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mErilainen’s picture

Is there a step missing from your instruction? Maybe Openlayers has been updated since the writing of the help text, but I need to select in the view OpenLayers Data Overlay -> Settings which field I want to use for the style of the marker. When I do this, I get a externalGraphic to the output of the view, but it doesn't seem to try to look anything from the path I have specified in the custom style of Openlayers, instead it's just looking at the root of the site: "'externalGraphic' => 'http://sitename.dev/Sales%20point',"

sbelmont’s picture

I've followed the instructions from #7, but when I look at the rendered map display. the filepath for the flag is coming up as icon-undefined.png. I'm not sure what I've missed!

I'm using OpenLayers 7.x-2.0-beta7. I have a taxonomy called "map category" with a text field I added that has the machine name "field-icon-name" for the name of the flag image file. In my "map category" taxonomy, I have several terms, and some of those terms have child taxonomies. One category, for example, is called Outdoors, and it has child terms of "Parks", "Rivers", etc. Rather than having one icon for all of the outdoor sites, my client would like to have different icons based on the child term. So I'm trying to show multiple flag icons on one OpenLayer map layer.

For the "Parks" child term, I have a flag icon named icon-outdoors-parks.png. I type "outdoors-parks" in my "Icon Name" text field. The file is in my sites/all/themes/bootstrap_base/plugins/openlayers/markers/ folder.

In my views, I have a data overlay called Outdoor Map that displays content with the parent "Outdoors" term. The preview includes the following parameters:

${field_map_category_rendered}
${field_map_category}
${field_icon_name_rendered}
${field_icon_name}

So then I have an OpenLayers style where I've set the externalGraphic URL to be sites/all/themes/bootstrap_base/plugins/openlayers_swva/markers/icon-${field_icon_name_rendered}.png, and I've set the Outdoor layer overlay to use this style on my map. But, when all is said and done, I have a broken image icon on my map, and firebug returns this path for the image icon: http://192.168.0.100/sites/all/themes/bootstrap_base/plugins/openlayers/...

I tried using all 4 tokens above in the externalGraphic URL with the same results. I can change my icon filename to icon-undefined and it shows up fine :P

please help!

artreaktor’s picture

Issue summary: View changes

In order to get it to work you need:
1. Add relationship to your Taxonomy reference field;
2. Add taxonomy image field and use Image URL Formatter to output image URL. Choose "Absolute file path" URL type.
3. Uncheck " Provide default field wrapper elements " in your view "OpenLayers Data Overlay" under View -> Format -> Show -> Settings. This removes all HTML wrappers which are the main culprits of problems.
4. Now you can follow this guide: https://drupal.org/node/1585880

sbelmont’s picture

I just ran into the same issue I had in #10 again, only this time I had two virtually identical views displaying as separate layers with custom markers based on taxonomy on the same map. One of the views would display the marker; the other came back with a filename of "undefined.png".

Turns out I had clustering turned on for the layer that wasn't working. If I disabled clustering, the custom markers show up perfectly. With clustering turned on, the filepaths for the icons come back with "undefined" in place of the token for the taxonomy term.

If I get some time once this project is finished up, I'd like to go through the module code and see if I can figure out what's going on with clustering that prevents the tokens from rendering properly in the filename.