[OpenLayers-Trac] [OpenLayers] #1073: Allow specification of per-entry icons for RSS feeds

OpenLayers trac at openlayers.org
Fri Nov 2 17:27:41 EDT 2007


#1073: Allow specification of per-entry icons for RSS feeds
---------------------------+------------------------------------------------
  Reporter:  ianmayo       |       Owner:  crschmidt  
      Type:  feature       |      Status:  new        
  Priority:  minor         |   Milestone:  2.6 Release
 Component:  Layer.GeoRSS  |     Version:  2.5 RC5    
Resolution:                |    Keywords:             
---------------------------+------------------------------------------------
Comment (by ahocevar):

 Replying to [ticket:1073 ianmayo]:
 > [this ticket is transposed from comments at the tail of #1604]
 >
 > Is there any merit in adding processing for the "category" attribute of
 each entry? OpenLayers could then plot an icon representing that type of
 event. For instance, if we had ''fall'', ''camp_out'' and ''puncture''
 category values for entries in a georss feed representing an off-road-
 biking journey we could show '''fall.png''', '''camp_out.png''' and
 '''puncture.png''' icons at those locations.

 I do not like the idea of wiring a category to a filename directly,
 because at the time you provide an image for a specific category, you can
 also provide a lookup entry in a table or something similar for it.

 > Alternatively an implementation could choose to use a lookup table of
 category versus image to use.

 This seems like a better solution, although I would not limit it to the
 "category" attribute. Has anyone thought about offering an alternative to
 OpenLayers.Layer.GeoRSS using OpenLayers.Layer.Vector instead of
 OpenLayers.Layer.Markers? In Mapbuilder, we transform GeoRSS to GML and
 apply it to a vector layer. By doing so, we can also display line and
 polygon geometries in GeoRSS layers.

 Ok, assuming our GeoRSS layer is a vector layer: we have our category in
 {{{OpenLayers.Feature.attributes['category']}}}, and we could use the
 style/rule framework I created for sld rendering
 (sandbox/ahocevar/sldRenderer). That would provide a kind of lookup table
 for use cases like the above, even without sld:

 {{{
 // style to be applied to any layer that inherits from
 OpenLayers.Layer.Vector
 var style = new OpenLayers.Style();

 var rule = new OpenLayers.Rule.Comparison({
         type: OpenLayers.Rule.Comparison.Type.EQUAL_TO,
         property: 'category'});

 style.rules.push(OpenLayers.Util.extend({
        value: 'fall',
        symbolizer['point']}: {externalGraphic: 'fall.png'}}, rule));

 style.rules.push(OpenLayers.Util.extend({
        value: 'camp_out',
        symbolizer['point']}: {externalGraphic: 'camp_out.png'}}, rule));

 style.rules.push(OpenLayers.Util.extend({
        value: 'puncture',
        symbolizer['point']}: {externalGraphic: 'puncture.png'}}, rule));
 }}}

-- 
Ticket URL: <http://trac.openlayers.org/ticket/1073#comment:2>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list