[OpenLayers-Users] custom feature markers
Christopher Schmidt
crschmidt at metacarta.com
Tue Jan 27 08:50:53 EST 2009
On Tue, Jan 27, 2009 at 03:40:55PM +0200, Samuli Saarinen wrote:
> 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);
> }
>
> };
http://openlayers.org/dev/examples/graphic-name.html
http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Renderer/Elements.js#L910
-- Chris
> 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
>
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list