Sorry, <br><br>The line that makes it not working is another one:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var styleMap = new OpenLayers.StyleMap({<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fillOpacity: 1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointRadius: 10<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var lookup = {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0: {fillColor: &quot;green&quot;, fillOpacity: 1, strokeColor: &quot;green&quot;},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1: {fillColor: &quot;green&quot;, fillOpacity: 1, strokeColor: &quot;green&quot;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; styleMap.addUniqueValueRules(&quot;default&quot;, &quot;type&quot;, lookup);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var mylayer =&nbsp;&nbsp; new OpenLayers.Layer.GML(&quot;GML&quot;, &quot;../KML/simples.xml&quot;); <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myLayer.styleMap = styleMap;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>/// This one :( so the rectangles don&#39;t appear</b><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayer(mylayer);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br><br><br><br><br><div class="gmail_quote">On Wed, Mar 5, 2008 at 3:35 PM, Carlos Pinto &lt;<a href="mailto:cmspinto@gmail.com">cmspinto@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Andreas, <br><br>sorry to keep bothering, but when I add this line the polygons don&#39;t appear :(<br><br><pre style="font-family: arial,sans-serif;"><font size="2"><div class="Ih2E3d"> var lookup = {<br>           0: {fillColor: &quot;green&quot;, fillOpacity: 0.7, strokeColor: &quot;green&quot;},<br>
</div>
           1: {fillColor: &quot;red&quot;, fillOpacity: 0.7, strokeColor: &quot;red&quot;}<br>        }<br>// until here it is everything ok<br><br></font><font size="2">// when I had this line the layer doesn&#39;t show up, I imagine he don&#39;t recognize the property</font><br>

<font size="2"><div class="Ih2E3d">styleMap.addUniqueValueRules(&quot;default&quot;, &quot;type&quot;, lookup);  <br><br><br></div>and I am using : </font> &lt;<span>script</span><span>  src</span>=<span>&quot;<a href="http://www.openlayers.org/dev/lib/OpenLayers.js" target="_blank">http://www.openlayers.org/dev/lib/OpenLayers.js</a>&quot;</span>&gt;&lt;/<span>script</span>&gt; <br>

<br>so it is version 2.6<br></pre><div><div></div><div class="Wj3C7c"><br><br><br><div class="gmail_quote">On Wed, Mar 5, 2008 at 3:06 PM, Andreas Hocevar &lt;<a href="mailto:andreas.hocevar@gmail.com" target="_blank">andreas.hocevar@gmail.com</a>&gt; wrote:<br>


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Carlos,<br>
<br>
everything below is perfect, except that you need to add:<br>
<br>
&lt;ms:type&gt;1&lt;/ms:type&gt;<br>
<br>
instead of<br>
<br>
&lt;type&gt;1&lt;/type&gt;<br>
<br>
And yes, you should add the {styleMap: styleMap} options hash to your<br>
GML layer constructor. Or, after constructing the layer, just do<br>
<br>
myLayer.styleMap = styleMap;<br>
<br>
Regards,<br>
<font color="#888888">Andreas.<br>
</font><div><br>
Carlos Pinto wrote:<br>
&gt; Hi all,<br>
&gt;<br>
</div><div><div></div><div>&gt; then, if I use OpenLayers 2.6 I can use this feature, can I ask a help<br>
&gt; of how then can I link the GML with the type?<br>
&gt; and how can I format the color, transparency and set border of the<br>
&gt; polygon?<br>
&gt;<br>
&gt; can I do like this?<br>
&gt; Thanks for your help, Carlos<br>
&gt;<br>
&gt;<br>
&gt; var lookup = {<br>
&gt; &nbsp; &nbsp;0: {fillColor: &quot;green&quot;, fillOpacity: 0.7, strokeColor: &quot;green},<br>
&gt; &nbsp; &nbsp;1: {fillColor: &quot;red&quot;, fillOpacity: 0.7, strokeColor: &quot;green&quot;},<br>
&gt;<br>
&gt; &nbsp; &nbsp;2: {fillColor: &quot;#00ffff&quot;, fillOpacity: 0.7, strokeColor: &quot;#00ffff&quot;}<br>
&gt;<br>
&gt; }<br>
&gt; styleMap.addUniqueValueRules(&quot;default&quot;, &quot;type&quot;, lookup);<br>
&gt;<br>
&gt; // when I had the layer how do I say to apply the rules????<br>
&gt; var mylayer = &nbsp; new OpenLayers.Layer.GML(&quot;GML&quot;,<br>
&gt; &quot;../KML/myPolygons.xml&quot;); // should I add here in the end {styleMap:<br>
&gt; styleMap}<br>
&gt; map.addLayer(mylayer);<br>
&gt;<br>
&gt; So I have put the line * &nbsp; &nbsp; &nbsp; &nbsp;&lt;type&gt;1&lt;/type&gt; &nbsp;* in &nbsp;the GML:<br>
&gt;<br>
&gt; &nbsp; &nbsp; &lt;gml:featureMember&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;ms:polygon fid=&quot;2&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;gml:boundedBy&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;gml:Box srsName=&quot;EPSG:4326&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;gml:coordinates&gt;0.511919,47.088176<br>
&gt; 3.002191,48.882988&lt;/gml:coordinates&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/gml:Box&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/gml:boundedBy&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ms:msGeometry&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;gml:Polygon srsName=&quot;EPSG:4326&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;gml:outerBoundaryIs&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;gml:LinearRing&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;gml:coordinates&gt;7.25,54.25 7.75,54.25 7.75,54.75<br>
&gt; 7.25,54.75 7.25,54.25&lt;/gml:coordinates&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/gml:LinearRing&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/gml:outerBoundaryIs&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/gml:Polygon&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ms:msGeometry&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ms:ogc_fid&gt;2&lt;/ms:ogc_fid&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ms:name&gt;My box that is class1 &lt;/ms:name&gt;<br>
&gt; * &nbsp; &nbsp; &nbsp; &nbsp;&lt;type&gt;1&lt;/type&gt; *<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ms:id&gt;0&lt;/ms:id&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &lt;/ms:polygon&gt;<br>
&gt; &nbsp; &nbsp; &lt;/gml:featureMember&gt;<br>
<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>