Closed (fixed)
Project:
Openlayers
Version:
7.x-2.0-beta1
Component:
OL API
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Jan 2010 at 14:01 UTC
Updated:
4 Dec 2012 at 06:45 UTC
Hello,
I'm trying customize the openlayers module using cloudmade layers.
How to customize markers ?
I don't see fields to add a custom icon.
How to choose and filter this icon by content type ?
Thanks for your help.
Comments
Comment #1
mcook commentedZen, I was having similar difficulties understanding how to do style customization, and then I found this issue thread. The first reply in that thread explains how to style by content-type -- in your view, you add this sort of code to the "Feature Styles" section of of the view style settings control (click the little widget beside "Style: Openlayers"). You don't have to do anything about the Callback field, just add the required styling code as a "Feature Styles function" -- each time the view adds a marker (or a line or a poly) to the map, it will run this function to decide how to style it.
Comment #2
zen-dupe commentedIt works very nice. Thank you mcook.
I suspected that's the place for customizing.
I just regret the poor documentation of this subject.
Where I can find more information about feature style ?
Comment #3
tmcw commentedHi zen,
There's more extensive documentation on styling markers on OpenLayers.org. If you can contribute anything more that applies specifically to this module (like reworking that issue conversation into documentation), it would be much appreciated to add it to the Drupal OpenLayers handbook.
Comment #4
zen-dupe commentedThank you for this information and for your help.
I'm trying to learn for the moment, I hope to contribute when I'll master the subject better.
Anyway. Congratulations for this project. OpenLayers has good potential, it's a super alternvative to Gmap.
I hope projects like mapbox emerge soon...
Comment #5
tmcw commentedHi zen,
Yep - there will be a lot of movement in OpenLayers soon, wish you the best of luck with your site
Comment #6
cpaszkiewicz commentedmcook, you say 'just add the required styling code as a "Feature Styles function" '
Where is this? I don't know where to add it.
Thanks.
Comment #7
ditcheva commentedI also cannot find, in Drupal 7, in the views section of either the OpenLayers Data overlay or display overlay, where to add this styling code. Can anyone share?
Comment #8
ditcheva commentedThe way I solved my problem is to add an extra field to my vocabulary called 'Marker URL' (because I want to vary my markers based on terms) and then edited my terms to fill in that field with a custom marker image url that will correspond to that term. You could, of course, alternatively have a field that just specifies a different color, etc per term.
Then -- in my view, I made sure I added this field to the data overlay layer, so that information is available when you're creating my map. You may need to use the vocabulary as a relationship to get to this new field.
Finally -- create a new style in your OpenLayer maps and just use the field (as it is stated in your custom styles section of your view) as the url or color or whatever component of the style you want to replace dynamically....
Hope that helps!
Comment #9
ekes commentedI've added documentation for this now:- https://drupal.org/node/1585880
Comment #11
japo32 commentedI'll try this with my current project.
Thanks Pal!