Thanks for the info. Got the featureselected event working.<br><br>I am having the issue of obtaining attributes of a feature.<br><br>This is how my code look like.<br><br>&nbsp;wfs_cities = new OpenLayers.Layer.WFS( &quot;WFS Cities&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;<a href="http://localhost:8080/geoserver/wfs">http://localhost:8080/geoserver/wfs</a>&quot;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {typename: &quot;topp:cities&quot;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; extractAttributes : true<br>
&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {styleMap: new OpenLayers.StyleMap({<br>&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; &quot;default&quot;: cities_symbolizer//,<br>&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; //&quot;select&quot; : cities_symbolizer_select<br>
&nbsp;&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; );<br><br>&nbsp;var selectControl = new OpenLayers.Control.SelectFeature(<br>&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; wfs_cities,<br>&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; {onSelect : onFeatureSelect});<br>&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; function onFeatureSelect(feature) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(feature.attribute.citiy_name);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addControl(selectControl);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selectControl.activate();<br>
<br>The alert above does not show any output.<br>By following this method is it necessary to do the following also to extract attribute information using GetFeature ?<br><br>&nbsp;wfs_cities.events.register(&#39;featureselected&#39;, map, function (e) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById(&#39;nodelist&#39;).innerHTML = &quot;Loading&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var url =&nbsp; wfs_cities.getFullRequestString(<br>&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //QUERY_LAYERS: map.layers[2].params.LAYERS,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROPERTYNAME: &#39;the_geom&#39;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FEATURE_COUNT: 50<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //FILTER: &#39;&lt;wfs:FeatureCollection xmlns:wfs=&quot;<a href="http://www.opengis.net/wfs">http://www.opengis.net/wfs</a>&quot; xmlns:ogc=&quot;<a href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>&quot; service=&quot;WFS&quot; version=&quot;1.1.0&quot; xmlns:gml=&quot;<a href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>&quot;&gt;&lt;gml:featureMember&gt;&lt;ogc:Filter&gt;&lt;ogc:Contains&gt;&lt;ogc:PropertyName&gt;the_geom&lt;/ogc:PropertyName&gt;&lt;gml:Point&gt;&lt;gml:coordinates&gt;&#39;+lonlatxy+&#39;&lt;/gml:coordinates&gt;&lt;/gml:Point&gt;&lt;/ogc:Contains&gt;&lt;/ogc:Filter&gt;&lt;/gml:featureMember&gt;&lt;/wfs:FeatureCollection&gt;&#39;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //WIDTH: map.size.w,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //HEIGHT: map.size.h<br>&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;<a href="http://localhost:8080/geoserver/wfs">http://localhost:8080/geoserver/wfs</a>&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br><br>Thanks in advance<br><br><br><div class="gmail_quote">2008/10/28 Eric Lemoine <span dir="ltr">&lt;<a href="mailto:eric.c2c@gmail.com">eric.c2c@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
As Arnd said you should use vectors styled with externalgraphic and<br>
the select feature control to be able to select your markers and<br>
display a popup on feature selection. To be notified on feature<br>
selection register a listener on the layer&#39;s featureselected event.<br>
featureselected listeners receive an object with a feature property<br>
referencing the selected feature. This is shown in the example Arnd<br>
pointed you to. Eric<br>
<br>
2008/10/28, Indika Tantrigoda &lt;<a href="mailto:indika85@gmail.com">indika85@gmail.com</a>&gt;:<br>
<div><div></div><div class="Wj3C7c">&gt; Thanks for the reply.<br>
&gt;<br>
&gt; It seems that when I click within the marker, I get different lon, lat<br>
&gt; values.<br>
&gt;<br>
&gt; Is it necessary to bind the markers to something ?<br>
&gt;<br>
&gt; Also with the extractAttributes:true, how can I access the attributes of the<br>
&gt; feature ?<br>
&gt;<br>
&gt; Regards,<br>
&gt; Indika<br>
&gt;<br>
&gt; 2008/10/27 Arnd Wippermann &lt;<a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>&gt;<br>
&gt;<br>
&gt;&gt; &nbsp;you can use a select control for the wfs layer.<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://openlayers.org/dev/examples/select-feature-openpopup.html" target="_blank">http://openlayers.org/dev/examples/select-feature-openpopup.html</a><br>
&gt;&gt;<br>
&gt;&gt; If you have load the wfs layer with extractAttributes: true, then your wfs<br>
&gt;&gt; data are saved in the attributes of the features.<br>
&gt;&gt;<br>
&gt;&gt; Arnd Wippermann<br>
&gt;&gt;<br>
&gt;&gt; &nbsp;------------------------------<br>
&gt;&gt; *Von:* <a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a> [mailto:<a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a>]<br>
&gt;&gt; *Im Auftrag von *Indika Tantrigoda<br>
&gt;&gt; *Gesendet:* Montag, 27. Oktober 2008 16:17<br>
&gt;&gt; *An:* OpenLayers users mailing list<br>
&gt;&gt; *Betreff:* [OpenLayers-Users] WFS Layers, Markers, Popups<br>
&gt;&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt; I have a wfs layer that displays points on my map, using markers.<br>
&gt;&gt; I would like to have a popup that displays data regarding the point which<br>
&gt;&gt; would get activated for a click event.<br>
&gt;&gt;<br>
&gt;&gt; I tried the following but, it seems to return all the data regarding the<br>
&gt;&gt; wfs layer, not the single point, irrespective of<br>
&gt;&gt; where I click on the map.<br>
&gt;&gt;<br>
&gt;&gt; &nbsp;wfs_cities.events.register(&#39;click&#39;, map, function (e) {<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#39;nodelist&#39;).innerHTML =<br>
&gt;&gt; &quot;Loading...<br>
&gt;&gt; please wait...&quot;;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var url = &nbsp;map.layers[2].getFullRequestString(<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REQUEST: &quot;GetFeature&quot;,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EXCEPTIONS: &quot;application/vnd.ogc.se_xml&quot;,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BBOX: map.getExtent().toBBOX(),<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; X: e.xy.x,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Y: e.xy.y,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INFO_FORMAT: &#39;text/html&#39;,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QUERY_LAYERS: map.layers[2].params.LAYERS,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FEATURE_COUNT: 50,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WIDTH: map.size.w,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HEIGHT: map.size.h<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;<a href="http://localhost:8080/geoserver/wfs" target="_blank">http://localhost:8080/geoserver/wfs</a>&quot;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br>
&gt;&gt;<br>
&gt;&gt; Any ideas how I can get around this ?<br>
&gt;&gt;<br>
&gt;&gt; Thanks in advance.<br>
&gt;&gt;<br>
&gt;&gt; Regards,<br>
&gt;&gt; Indika<br>
&gt;&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>