Adding extra styles to taxonomy terms in openlayers
I'll be using one to three stars rating as an example on top of the Springfield restaurants tutorial. Each restaurant will be represented as a star rating on the map itself.
To implement this we will be
- Adding the stars to the openlayers styles
- Creating a new taxonomy field to represent the star ratings
- Making clones of the openlayers display and adding an extra filter for each star
- Enabling the view's displays in openlayers as layers
Contextual Filters must be completed first because it also contains all the configuration and setup information.
- Add the star images to the openlayers styles
- Create a new taxonomy vocabulary for the star ratings and add the rating terms to that vocabulary
- Go into the content type and add a new term reference field and assign it to the correct vocabulary
- Now edit the contents to assign a star rating to the taxonomy field
Go the openlayers data overlay display in the views settings
- I'm going to change the display name to one stars
In the filter criteria section add the taxonomy field that you created in the content type. In my case it was called Restaurant Rating
- Select the rating for the vocabulary
- And Dropdown for the selection type
- In the following overlay window, select the appropriate rating term, in my case for this display it will be one stars
- Clone this display and rename it to two stars
- Go down to the filter criteria and change the taxonomy term to two stars
- And then clone this display again and change the taxonomy term filter to three stars
Edit your openlayers map, select the Layers & Styles section
- And enable and activate the layers that you created from your view's displays
- And select the appropriate style for each layer
- That should be it and the default dot should now be replaced by the star ratings.
This tutorial was a direct follow on from Contextual Filters, where we spent more time on creating additional styles, mapping those styles to taxonomy terms via the views displays.
You do need to manually create the extra views displays and the extra filter criterias which some people may find a little clunky so I'm going to checkout the same solution using openlayers taxonomy module to see if that will be a more graceful approach.
Thanks for watching and remember don't forget to flush your cache!
- New post: Posting location co-ordinates to a drupal service - Part 2 http://t.co/MQhlVKBNKC — 1 month 1 week ago
- New post: Posting location co-ordinates to a drupal service - Part 1 http://t.co/2xlYgqFaJ0 — 1 month 1 week ago
- New post: Connecting a drupal service with a mobile application - Part 2 http://t.co/01cFtAunDs — 1 month 1 week ago
- New post: Using drupal services to connect to mobile applications - Part 1 http://t.co/VEURftHCef — 1 month 1 week ago
- New post: Creating Drupal 7 video gallery http://t.co/HvpKU7uT — 3 months 1 week ago