AW: [OpenLayers-Users] How can I display each polygon in a differentcolor?

Arnd Wippermann arnd.wippermann at web.de
Thu May 3 16:10:15 EDT 2012


It's the same as with your firestations layer:

map.addLayer(new OpenLayers.Layer.GML("OV's 2.000 Meter", "2000meter.xml", {

   format: OpenLayers.Format.KML({extractStyles:false}), 
   style: {strokeColor: "red", strokeWidth: 5, strokeOpacity: 1,
fillColor:red, fillOpacity:0.5},
   projection: map.displayProjection 

}));

Except you don't ectract the styles from the kmlfile.

Arnd
 

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Markus
Gesendet: Donnerstag, 3. Mai 2012 19:07
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] How can I display each polygon in a
differentcolor?

Hello OpenLayers Team.

i have this Code dev. (Attachment).
How can I display each polygon in a different color?

map.addLayer(new OpenLayers.Layer.GML("OV's 2.000 Meter", "2000meter.xml", {
format: OpenLayers.Format.KML, projection: 
map.displayProjection }));

map.addLayer(new OpenLayers.Layer.GML("OV's 4.000 Meter", "4000meter.xml", {
format: OpenLayers.Format.KML, projection: 
map.displayProjection }));

First in Green
Second in Red
...

Search a good documentation and example. Found something but not help.

Thanks all.

Bye Markus

My Map online: http://www.meldekopf.de/osm/pn/map.html



More information about the Users mailing list