<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>It still does not seem to work with the test I sent. I have tried </div><div><br></div><div><div><b>vector_layer = new OpenLayers.Layer.Vector(</b></div><div><span class="Apple-tab-span" style="white-space:pre"><b>        </b></span><b>{styleMap: new OpenLayers.StyleMap({fillColor: "#991605"})</b></div><div><b>);</b></div></div><div><br></div><div>And also:</div><div><br></div><div><b>map.addLayer(vector_layer,</b></div><div><span class="Apple-tab-span" style="white-space: pre; "><b>                                </b></span><b>{styleMap: new OpenLayers.StyleMap({fillColor: "#991605"})</b></div><div><b>);</b></div><div><br></div><div>And also:</div><div><br></div><div><b>vector_layer.addFeatures(geojson_format.read(test_territory), {styleMap: new OpenLayers.StyleMap({fillColor: "#991605"}));</b></div><div><br></div><div>None of which work. Please can you edit my example, or provide an example as nothing seems to be working for me.</div><div><br></div><div>Thanks for your help,</div><div><br></div><div>Toby</div><div><br></div><div><br>-----Original Message-----</div>Add a styleMap to your vector layer options parameter.<br>{styleMap: new OpenLayers.StyleMap({bla bla bla})} <br><br>-----Original Message-----<br>From: users-bounces@openlayers.org [<a href="mailto:users-bounces@openlayers.org">mailto:users-bounces@openlayers.org</a>]<br>On Behalf Of Toby Rainthorpe<br>Sent: Monday, November 24, 2008 6:12 AM<br>To: <a href="mailto:users@openlayers.org">users@openlayers.org</a><br>Subject: [OpenLayers-Users] Simple Styling Problem<br><br>Given the simple test below, does anyone know how I would style the<br>test_territory polygon? Or for that matter the whole of the<br>vector_layer?<br><br>Thanks for your help,<br><br>Toby<br><br><html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"><br> <head><br> <link rel="stylesheet" href="../theme/default/style.css" <br>type="text/css" /><br> <link rel="stylesheet" href="style.css" type="text/css" /><br> <script src="../lib/OpenLayers.js"></script><br> <script type="text/javascript"><br> var lon = 0.30271;<br> var lat = 53.29408;<br> var zoom = 8;<br> var map, layer;<br><br> function init(){<br> map = new OpenLayers.Map( 'map' );<br> layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br> "<a href="http://labs.metacarta.com/wms/vmap0">http://labs.metacarta.com/wms/vmap0</a>",<br> {layers: 'basic'} );<br> map.addLayer(layer);<br> map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);<br><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><br> var test_territory = {"type":"Polygon","coordinates": <br>[[[0.30271,53.29408],[0.32185,53.27152],[0.23484,53.19422],<br>[0.19443,53.21331],[0.16971,53.21241],[0.08345,53.23488],<br>[0.02083,53.24781],[-0.01269,53.17102],[-0.13717,53.14185],<br>[-0.15075,53.12439],[-0.13071,53.02398],[-0.22929,53.00390],<br>[-0.33850,53.06091],[-0.40868,53.05562],[-0.45224,53.05795],<br>[-0.48515,53.12857],[-0.52103,53.14277],[-0.54183,53.19215],<br>[-0.49520,53.22299],[-0.48566,53.22575],[-0.51875,53.22722],<br>[-0.53484,53.22819],[-0.53926,53.22850],[-0.53759,53.23366],<br>[-0.55354,53.25197],[-0.57064,53.23427],[-0.56796,53.23333],<br>[-0.54251,53.22764],[-0.54796,53.21912],[-0.55416,53.20214],<br>[-0.56246,53.19333],[-0.57082,53.17395],[-0.67832,53.10239],<br>[-0.69929,53.07564],[-0.71693,53.11059],[-0.67402,53.21872],<br>[-0.66818,53.25521],[-0.77575,53.24668],[-0.76478,53.26913],<br>[-0.75146,53.32024],[-0.56708,53.35294],[-0.54906,53.42575],<br>[-0.46125,53.42901],[-0.45928,53.43568],[-0.49191,53.49760],<br>[-0.41390,53.55006],[-0.31045,53.52675],[-0.21935,53.52730],<br>[-0.21503,53.50638],[-0.20327,53.46674],[-0.12254,53.45489],<br>[0.02643,53.46201],[0.08385,53.49654],[0.22836,53.40840],<br>[0.26803,53.34254],[0.30271,53.29408]],[[-0.40406,53.32102],<br>[-0.41035,53.29527],[-0.42949,53.26455],[-0.36920,53.22594],<br>[-0.37631,53.20236],[-0.31336,53.18250],[-0.28899,53.17916],<br>[-0.25398,53.23297],[-0.30694,53.33457],[-0.40406,53.32102]]]};<br><br> var geojson_format = new OpenLayers.Format.GeoJSON();<br> var vector_layer = new OpenLayers.Layer.Vector();<br><br> map.addLayer(vector_layer);<br><br>vector_layer.addFeatures(geojson_format.read(test_territory));<br> }<br> </script><br> </head><br> <body onload="init()"><br> <h1 id="title">GeoJSON Example</h1><br> <div id="map" class="smallmap"></div><br> </body><br></html><br><br></body></html>