[OpenLayers-Users] Markers (circle, triangle, x, cross, etc) to be rendered in custom div?

Tim Schaub tschaub at opengeo.org
Thu Feb 25 21:47:27 EST 2010


Jonathan Sawyer wrote:
> Good afternoon OpenLayers community!
> 
> I have a question regarding the rendering of various build in graphic 
> styles (names). Can I render, say, a circle marker into a custom <div />?
> 

For vector symbols rendered client side, we use a different renderer 
depending on the browser.  So your circle might be rendered using SVG, 
VML, or Canvas.  In order to display the same symbol in another element 
on the page, you can use the same renderer that the vector layer does.

This takes a bit of fiddling to get right (assuming you want rules in a 
vector layer's style to be applied).  I've put together a sandbox in 
GeoExt that does this with a VectorLegend component.  If you are not 
using Ext but would like to do the same, you could follow the same approach.

http://dev.geoext.org/sandbox/opengeo/style/geoext/examples/vector-legend.html

In short, it isn't trivial.

Tim

> For example:
> 
> Using these graphic names: 
> http://openlayers.org/dev/examples/graphic-name.html
> I would like to be able to, as well as adding a feature to a layer using 
> that graphic name as its representation, store that exact graphic, as 
> rendered on the map, in a div element as a "key". I am building a user 
> interface that puts layers that have been added to the map into one 
> portion of the window. I want to identify the layer with its layer on 
> the map via the style its using.
> 
> I hope this makes sense. Thank you in advance!
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list