hi,<div><br></div><div>you can set an external stylemap and then color the polygons individually by attribute.<br><br><div class="gmail_quote">On Mon, Jun 20, 2011 at 7:35 AM, pday <span dir="ltr">&lt;<a href="mailto:pday@mitre.org">pday@mitre.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello,<br>
<br>
I am trying to pass in GeoJSON to a simple proof of concept mapping example.<br>
What I am hoping to do is pass a single GeoJSON file (hard-coded below only<br>
for demo&#39;s sake, will be read in soon), with multiple polygons of different<br>
colors.<br>
<br>
Can this be done in a single GeoJSON file or am I restricted to coloring<br>
them all the same per file? I tried setting the fillColor property under<br>
each polygon in the featurecollection below but was unsuccessful.<br>
<br>
My init() function is below that sets the map and parses two simple<br>
polygons. Thank you<br>
<br>
-Pat<br>
<br>
 function init(){<br>
            map = new OpenLayers.Map( &#39;map&#39; );<br>
            layer = new OpenLayers.Layer.WMS( &quot;OpenLayers WMS&quot;,<br>
                    &quot;<a href="http://vmap0.tiles.osgeo.org/wms/vmap0" target="_blank">http://vmap0.tiles.osgeo.org/wms/vmap0</a>&quot;,<br>
                    {layers: &#39;basic&#39;} );<br>
            map.addLayer(layer);<br>
            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);<br>
            var featurecollection = {<br>
              &quot;type&quot;: &quot;FeatureCollection&quot;,<br>
              &quot;features&quot;: [<br>
                {&quot;geometry&quot;: {<br>
                    &quot;type&quot;: &quot;GeometryCollection&quot;,<br>
                    &quot;geometries&quot;: [<br>
                                                {<br>
                                                        type: &quot;Polygon&quot;,<br>
                                                        coordinates:<br>
                                                        [[<br>
                                                                [-14.7656,  73.0309],<br>
                                                                [-30.2344, 46.0929],<br>
                                                                [-9.8438, -47.9709],<br>
                                                                [-94.9219, -59.1614],<br>
                                                                [-124.4531, -18.6194],<br>
                                                                [-155.3906, 45.6031],<br>
                                                                [-137.1094, 75.3272]<br>
                                                        ]]<br>
                                                },<br>
                                                {<br>
                                                        type: &quot;Polygon&quot;,<br>
                                                        coordinates:<br>
                                                        [[<br>
                                                                [-106.1719, -28.8968],<br>
                                                                [-16.1719, 41.5298],<br>
                                                                [39.3750, -37.1377]<br>
                                                        ]]<br>
                                                }<br>
                    ],<br>
                },<br>
                &quot;type&quot;: &quot;Feature&quot;,<br>
                &quot;properties&quot;: {}}<br>
              ]<br>
           };<br>
           var geojson_format = new OpenLayers.Format.GeoJSON();<br>
           var vector_layer = new OpenLayers.Layer.Vector();<br>
           map.addLayer(vector_layer);<br>
           vector_layer.addFeatures(geojson_format.read(featurecollection));<br>
<br>
        }<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/GeoJSON-Fill-Colors-tp6495593p6495593.html" target="_blank">http://osgeo-org.1803224.n2.nabble.com/GeoJSON-Fill-Colors-tp6495593p6495593.html</a><br>

Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</font></blockquote></div><br></div>