[OpenLayers-Users] custom feature markers
Samuli Saarinen
samuli.saarinen at remion.com
Tue Jan 27 08:40:55 EST 2009
Christopher Schmidt wrote:
> http://docs.openlayers.org/library/feature_styling
>
> "In this way, the style can contain rendering information which is
> dependant on the feature: for example, in a Style object, the string
> ${thumbnail} is replaced by the feature’s ‘thumbnail’
> attribute."
Hi and thanks for the quick reply!
I have read the docs but AFAIKT the "${thumbnail}" is replaced with a
url of a server-side image. What I am trying to achive is to be able to
draw custom image on the client side using OL.
Something along the lines
var context = {
getGraphic: function(feature) {
return
OpenLayers.Geometry.Polygon.createRegularPolygon(feature.geometry,1,4, 45);
}
};
var template = {externalGraphic: "${getGraphic}"};
var style = new OpenLayers.Style(template, {context: context});
Is this somehow possible?
I hope this helps to understand what I'm trying to accomplish.
> However, OpenLayers KML support does not have support for any kind of
> attribute parsing from KML other than title and description. I would
> recommend that you should instead use KML <Style> or <StyleURL> blocks,
> and set extractStyles to true on your KML format, which will indicate
> that OpenLayers should parse and use those styles.
Yes we have been using KML with styles but I think we'll have to change
that to (geo)JSON if I can get the client side feature drawing working.
-Samuli
More information about the Users
mailing list