[OpenLayers-Dev] styleMap and GeoRSS

Andreas Hocevar andreas.hocevar at gmail.com
Mon Feb 25 18:53:25 EST 2008


Dejung Gewissler wrote:
> Hi Devs,
> I am trying to figure out the most efficient way to handle point 
> features displayed with icons. We have the requirement to symbolize 
> point features differently based on a particular value (pretty much what 
> happens when you add a text layer with different icons). However, we 
> can't have the icon path live in the same location as the data, so we 
> would like to use the new Rules class to specify which icons to use 
> (kind of like the example 
> http://openlayers.org/dev/examples/georss-flickr.html ). Here is a code 
> snippet of what we would like to do:
> ...but this doesn't work :(
> The problem is that the rules based styling is only available for vector 
> layers. Now, I could extend the GeoRSS class (which we are currently 
> using with hard coded icon paths) to accept a simplified version of the 
> styleMap and then set the icons src based on it .. but that seems like 
> reinventing the wheel when the georss-flickr.html example works fine.

The georss-flickr example uses Format.GeoRSS and a vector layer. As you 
can see, this works with very little tweaking. Since this is the same 
format that Layer.GeoRSS uses, it would not make sense to use 
Layer.GeoRSS just for the sake of using Format.GeoRSS.

If, however, you want to use other selectable vector layers along with 
your markers, or tooltips on your markers, you could have a look at 

This probably does what you want, but it is based on a very early 
version of the whole styling thing and will need some work.
> My question is... which method would be better in the long run? We will 
> be pushing quite a few points across. I am aware of the limitations with 
> the vector/point overlays and can already notice a small lag when adding 
> a simplified GML layer to the map. What are your thoughts about choosing 
> which format to display with? Are there significant issues in using 
> SVG/VML to display points with icons when the simple GeoRSS class just 
> uses divs with icons?

If you have a choice, GeoJSON is probably the fastest. Also, if you 
never zoom to an extent where all your markers are visible, any kind of 
WFS layer will be faster  compared with its GML/GeoJSON counterpart 
because it only loads features within the visible bounding box.

The only drawbacks of vector markers compared to html image markers are

    * it's harder to do tooltips (can be overcome by popups onhover)
    * vector layers below the vector marker layer cannot use
      SelectFeature or ModifyFeature (can probably be overcome by moving
      the marker layer to underneath the other vector layer before
      working with that one)


More information about the Dev mailing list