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

Alexandre Dube adube at mapgears.com
Fri Mar 4 08:24:13 EST 2011


Hi,

Take a look at the following examples. They might demonstrate what you need.
http://dev.openlayers.org/releases/OpenLayers-2.10/examples/style-rules.html
http://dev.openlayers.org/releases/OpenLayers-2.10/examples/styles-unique.html

Regards,

Alexandre


On 11-03-03 05:06 PM, Planet)x wrote:
>   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.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list