[OpenLayers-Users] Multiple Styles for grouped vector layers with multiple featuretypes possible?

Planet)x andrew.stewart at reddeer.ca
Thu Mar 3 17:06:27 EST 2011


 With my below code I have multiple featuretypes grouped into a single WFS
layer and they are both displaying properly. My problem is I need to define
2 different styles one for each featuretype. Can I do it this way somehow or
do I need to modify my code?

//Test Vector Style
   var style_attraction = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']);
       style_attraction.externalGraphic = 'sask.jpg';
       style_attraction.cursor =  'hand';
       style_attraction.graphicHeight = 35;
       style_attraction.graphicWidth = 35;
       style_attraction.graphicOpacity = 0.8;
   
     //Areas of Interest Group
           var layer_AOIs_wfs = new OpenLayers.Layer.Vector("Attraction", {
                minScale: 125000,
                maxScale: 99,
                styleMap: new OpenLayers.StyleMap(style_attraction),
                strategies: [new OpenLayers.Strategy.BBOX()],
                
                 protocol: new OpenLayers.Protocol.WFS({
                 url: wfs,
                 featureType: ["Attraction", "Fire_Hall"],
                 featureNS: "http://www.intergraph.com/geomedia/gml",
                 featurePrefix: "gmgml",
                 srsName: "EPSG:3776",
                 geometryName: "Geometry",
                 version: "1.1.0"
                })
                });
   
     //Add Vector Layers to Map
     map.addLayer(layer_AOIs_wfs);

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Multiple-Styles-for-grouped-vector-layers-with-multiple-featuretypes-possible-tp6086563p6086563.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list