Thanks!<br><br>I forgot to addControl and activate().<br><br><pre id="line1">map.addControl(selectControl);<br>selectControl.activate();  </pre><br><br><div><span class="gmail_quote">On 12/03/2008, <b class="gmail_sendername">Christopher Schmidt</b> &lt;<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Wed, Mar 12, 2008 at 03:26:24PM +0000, Xin wrote:<br> &gt; Hi,<br> &gt;<br> &gt; I have a KML layer which I want to be able to click and see a pop up. I am<br> &gt; following the following examples, but it&#39;s not working for me.<br>
 <br> <br><a href="http://dev.openlayers.org/sandbox/euzuro/pop/examples/sundials.html">http://dev.openlayers.org/sandbox/euzuro/pop/examples/sundials.html</a><br> <br> Is a KML example with a selectFeature control and popups. Maybe you<br>
 could compare to that and see if it helps you out any. I don&#39;t think the<br> projection will affect things any in this case.<br> <br> -- Chris<br> <br><br> &gt; <a href="http://openlayers.org/dev/examples/select-feature.html">http://openlayers.org/dev/examples/select-feature.html</a><br>
 &gt; <a href="http://openlayers.org/dev/examples/select-feature-openpopup.html">http://openlayers.org/dev/examples/select-feature-openpopup.html</a><br> &gt;<br> &gt; My map is projected. The init code is:<br> &gt;<br> &gt; var options = {<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; projection: new OpenLayers.Projection(&quot;EPSG:900913&quot;),<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayProjection: new OpenLayers.Projection(&quot;EPSG:4326&quot;),<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; units: &quot;m&quot;,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxResolution: 156543.0339,<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxExtent: new OpenLayers.Bounds(-20037508, -20037508,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20037508, 20037508.34),<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; restrictedExtent:&nbsp;&nbsp;new OpenLayers.Bounds(-102731.36592167988,-<br>
 &gt; 3815736.451414842,3869548.1192908203,-1311047.9090148422)<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; };<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; map = new OpenLayers.Map(&#39;map&#39;, options);<br> &gt;<br> &gt; My KML is therefore also projected. The code:<br> &gt;<br> &gt; kmlLayer = new OpenLayers.Layer.GML(&quot;KML&quot;, kmlFeedUrl,<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; projection: new OpenLayers.Projection(&quot;EPSG:4326&quot;),<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format: OpenLayers.Format.KML,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; formatOptions: {<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; extractStyles: true,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; extractAttributes: true<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;map.addLayer(kmlLayer);<br> &gt;<br> &gt; This is all working so far, and I&#39;m pretty happy about it. Thanks goes out<br> &gt; to Chris and the community.<br> &gt;<br>
 &gt; My KML consist of points.<br> &gt;<br> &gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br> &gt; &lt;kml xmlns=&quot;<a href="http://earth.google.com/kml/2.1">http://earth.google.com/kml/2.1</a>&quot;&gt;<br>
 &gt;&nbsp;&nbsp; &lt;Document&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Style id=&quot;marker&quot;&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;IconStyle&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Icon&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;href&gt;<a href="http://localhost:3000/openlayers/img/marker-green.png">http://localhost:3000/openlayers/img/marker-green.png</a>&lt;/href&gt;<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Icon&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/IconStyle&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Style&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Placemark id=&quot;13856&quot;&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;place name&lt;/name&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;description&gt;NULL::character varying&lt;/description&gt;<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;styleUrl&gt;#marker&lt;/styleUrl&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Point&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;altitudeMode&gt;relativeToGround&lt;/altitudeMode&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;coordinates&gt;23.29555556,-17.98611111&lt;/coordinates&gt;<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Point&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Placemark&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Placemark id=&quot;13852&quot;&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;place name 2&lt;/name&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;description&gt;NULL::character varying&lt;/description&gt;<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;styleUrl&gt;#marker&lt;/styleUrl&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Point&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;altitudeMode&gt;relativeToGround&lt;/altitudeMode&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;coordinates&gt;24.56638889,-17.54027778&lt;/coordinates&gt;<br>
 &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Point&gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Placemark&gt;<br> &gt;&nbsp;&nbsp; &lt;/Document&gt;<br> &gt; &lt;/kml&gt;<br> &gt;<br> &gt; I would like the user to be able to click on these points, and see a popup<br> &gt; window consisting of name and description. After this KML layer is added, I<br>
 &gt; add a select control as suggested from Vector file popup examples.<br> &gt;<br> &gt; selectControl = new OpenLayers.Control.SelectFeature( kmlLayer,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{onSelect: onFeatureSelect, onUnselect:<br>
 &gt; onFeatureUnselect});<br> &gt;<br> &gt; I also copied over onFeatureSelect and onFeatureUnselect.<br> &gt;<br> &gt; When I click on a marker, nothing happens. Do I need to project<br> &gt; SelectFeature? Does SelectFeature work with Points from a KML file?<br>
 &gt;<br> &gt; Sorry for the long post! Any help is much appreciated.<br> &gt;<br> &gt; Xin<br> <br> <br>&gt; _______________________________________________<br> &gt; Users mailing list<br> &gt; <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
 &gt; <a href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a><br> <br><br> <br> --<br> Christopher Schmidt<br> MetaCarta<br> _______________________________________________<br>
 Users mailing list<br> <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br> <a href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a><br> </blockquote></div><br>