[OpenLayers-Dev] How to modify GML style

Alexandre Dube adube at mapgears.com
Tue Sep 9 08:00:42 EDT 2008


Hi Gorka,

  You can style your features with a StyleMap object.  Here's an example 
using a WFS layer, but this is pretty much the same as GML, since both 
are vector layers.

// styleMap for region
oRegStyleMap = new OpenLayers.StyleMap({
      strokeColor: "black",
      strokeWidth: 2,
      strokeOpacity: 1
      fillOpacity: 0.3,
      fillColor:"purple"
});

// region WFS layer, contains polygon features
olWFSReg = new OpenLayers.Layer.WFS(
    "Régions admin. - WFS",
    sMSURL,
    {
        typename: "BDGA_REGIO_S_POLY_1M",
        map: sBDGAMapPath
    },
    {
        extractAttributes: true,
        typename: "BDGA_REGIO_S_POLY_1M",
        styleMap: oRegStyleMap // <------
    }
);

Hope this helps,

Alexandre

Gorka López Rivacoba wrote:
> Hello,
>  
> I'm loading a route with GML in my map, but the line which appears 
> (the yellow one) is too similar to my map. I'm reading the code, but I 
> don't find any solution
>  
> Is there any solution to modify the style of these lines?
>  
> Thanks a lot. Regards,
>  
> Gorka López
> ------------------------------------------------------------------------
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Dev mailing list