Hi all,<br><br>Maybe it is a problem with my install of OpenLayers, I have version 2.5<br><br>But this exemple don&#39;t show the Markers in my computer, <br>It shows the map but not the markers, shoud I download the version 2.6?<br>
what am I doing wrong?<br><br>Thanks, Carlos<br><br><br>&nbsp;&nbsp;&nbsp; &lt;link rel=&quot;stylesheet&quot; href=&quot;../OpenLayer/theme/default/style.css&quot; type=&quot;text/css&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;style type=&quot;text/css&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #map {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width: 800px;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height: 400px;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; border: 1px solid black;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &lt;/style&gt;<br>&nbsp;&nbsp;&nbsp; &lt;script src=&quot;../OpenLayer/lib/OpenLayers.js&quot;&gt;&lt;/script&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;script type=&quot;text/javascript&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var map, layer;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init(){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map = new OpenLayers.Map(&#39;map&#39;, {maxResolution:&#39;auto&#39;});<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var wms = new OpenLayers.Layer.WMS( &quot;OpenLayers WMS&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;<a href="http://labs.metacarta.com/wms/vmap0">http://labs.metacarta.com/wms/vmap0</a>&quot;, {layers: &#39;basic&#39;} );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayer(wms);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.setCenter(new OpenLayers.LonLat(0, 0), 0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // create 20 random features with a random type attribute. The<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // type attribute is a value between 0 and 2.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var features = new Array(20);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (var i=0; i&lt;20; i++) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; features[i] = new OpenLayers.Feature.Vector(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new OpenLayers.Geometry.Point(Math.random()*360-180, Math.random()*180-90),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {type: parseInt(Math.random()*3)}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // create a styleMap with a custom default symbolizer<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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // create a lookup table with different symbolizers for 0, 1 and 2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var lookup = {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0: {externalGraphic: &quot;../OpenLayer/img/marker-blue.png&quot;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1: {externalGraphic: &quot;../OpenLayer/img/marker-green.png&quot;},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2: {externalGraphic: &quot;../OpenLayer/img/marker-gold.png&quot;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add rules from the above lookup table, with the keyes mapped to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // the &quot;type&quot; property of the features, for the &quot;default&quot; intent<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; styleMap.addUniqueValueRules(&quot;default&quot;, &quot;type&quot;, lookup);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layer = new OpenLayers.Layer.Vector(&#39;Points&#39;, {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; styleMap: styleMap<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layer.addFeatures(features);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayer(layer);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br><br><br><div class="gmail_quote">
On Fri, Feb 29, 2008 at 12:10 PM, Andreas Hocevar &lt;<a href="mailto:andreas.hocevar@gmail.com">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>
<div class="Ih2E3d"><br>
Carlos Pinto wrote:<br>
&gt; I have try to use SLD but I was missing something.<br>
&gt;<br>
&gt; Then I try to apply the &nbsp;style and wen I put this line:<br>
&gt;<br>
&gt;<br>
&gt; var styleMap = new OpenLayers.StyleMap(OpenLayers.Util.extend(<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; {fillColor: &quot;green&quot;, fillOpacity: 1, strokeColor: &quot;black&quot;},<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; OpenLayers.Feature.Vector.style[&quot;default&quot;]);<br>
&gt;<br>
&gt; the map just stop working :(<br>
<br>
</div>There is nothing wrong with this style map definition. Also, if you just<br>
add this line, nothing should stop working, because you do not apply<br>
this style map to a layer.<br>
<br>
But are you using SLD or are you defining your StyleMap in JavaScript?<br>
<div class="Ih2E3d"><br>
<br>
&gt; The problem is so simple and I can&#39;t get a solution, I have a gml file<br>
&gt; with 300 polygons but with only 20 classes and I just want to make<br>
&gt; each class with diferent collor, in this example I have two squares<br>
&gt; with class 2 should be red and class 3 green but when I make load the<br>
&gt; sld file for this simple example nothing happens and when I try the<br>
&gt; style the map doesn&#39;t show, the gml file:<br>
<br>
</div>Which attribute holds your class? I don&#39;t see it in your GML. The only<br>
&quot;2&quot; and &quot;3&quot; I see is in your fid (feature id), and if you have multiple<br>
features with the same fid, map rendering will probably fail because of<br>
that. The fid is supposed to be a unique id.<br>
<br>
Also, where are you loading your SLD? What does it look like? Maybe you<br>
can share an URL, that would make it easier to see your problem.<br>
<br>
But your requirement is now 100% covered by<br>
<a href="http://www.openlayers.org/dev/examples/styles-unique.html" target="_blank">http://www.openlayers.org/dev/examples/styles-unique.html</a><br>
<br>
Maybe you want to have a look at that and see if that works for you. No<br>
need to use SLD in that case.<br>
<br>
Regards,<br>
<font color="#888888">Andreas.<br>
<br>
<br>
</font></blockquote></div><br>