Thanks for the info. Got it working.<br><br><div class="gmail_quote">2008/10/28 Arnd Wippermann <span dir="ltr"><<a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"><span>Try this, to get all attributes for the
feature:</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"><span></span></font> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2">function
onFeatureSelect(feature)
{
<br> var Msg="";<br> for(var key in
feature.attributes)<br> Msg
+= <span>key + ":" +
</span>feature.attributes[key] + "\r\n";<br>
alert(Msg);<br>}</font></div>
<div><font color="#0000ff" face="Arial" size="2"></font> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"><span>but perhaps you mean </span></font><font color="#0000ff" face="Arial" size="2">city_name<span> instead of
</span>citiy_name<span>.</span></font></div>
<div><font color="#0000ff" face="Arial" size="2"><span></span></font> </div>
<div><font color="#0000ff" face="Arial" size="2"><span>Arnd
Wippermann</span></font></div>
<div dir="ltr" align="left"><br></div><br>
<div dir="ltr" align="left" lang="de">
<hr>
<font face="Tahoma" size="2"><b>Von:</b> <a href="mailto:indika85@gmail.com" target="_blank">indika85@gmail.com</a>
[mailto:<a href="mailto:indika85@gmail.com" target="_blank">indika85@gmail.com</a>] <br><b>Gesendet:</b> Dienstag, 28. Oktober 2008
11:47<br><b>An:</b> Eric Lemoine<br><b>Cc:</b> Arnd Wippermann;
<a href="mailto:users@openlayers.org" target="_blank">users@openlayers.org</a><br><b>Betreff:</b> Re: [OpenLayers-Users] WFS Layers,
Markers, Popups<br></font><br></div><div><div></div><div class="Wj3C7c">
<div></div>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> wfs_cities = new OpenLayers.Layer.WFS( "WFS
Cities",<br>
"<a href="http://localhost:8080/geoserver/wfs" target="_blank">http://localhost:8080/geoserver/wfs</a>",<br>
{typename:
"topp:cities",<br>
extractAttributes :
true<br>
},<br>
{styleMap: new
OpenLayers.StyleMap({<br>
"default":
cities_symbolizer//,<br>
//"select" :
cities_symbolizer_select<br>
})}<br>
);<br><br> var selectControl = new
OpenLayers.Control.SelectFeature(<br>
wfs_cities,<br>
{onSelect :
onFeatureSelect});<br>
<br> function
onFeatureSelect(feature)
{
<br>
alert(feature.attribute.citiy_name);<br>
} <br>
<br>
map.addControl(selectControl);<br>
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> wfs_cities.events.register('featureselected', map, function (e)
{<br>
document.getElementById('nodelist').innerHTML =
"Loading";<br>
var url =
wfs_cities.getFullRequestString(<br>
{<br>
//SERVICE :
'WFS',<br>
REQUEST:
"GetFeature",<br>
EXCEPTIONS:
"application/vnd.ogc.se_xml",<br>
//BBOX:
map.getExtent().toBBOX(),<br>
//X:
e.xy.x,<br>
//Y:
e.xy.y,<br>
INFO_FORMAT:
'text/html',<br>
//QUERY_LAYERS:
map.layers[2].params.LAYERS,<br>
PROPERTYNAME:
'the_geom',<br>
FEATURE_COUNT:
50<br>
//FILTER: '<wfs:FeatureCollection xmlns:wfs="<a href="http://www.opengis.net/wfs" target="_blank">http://www.opengis.net/wfs</a>" xmlns:ogc="<a href="http://www.opengis.net/ogc" target="_blank">http://www.opengis.net/ogc</a>" service="WFS"
version="1.1.0" xmlns:gml="<a href="http://www.opengis.net/gml" target="_blank">http://www.opengis.net/gml</a>"><gml:featureMember><ogc:Filter><ogc:Contains><ogc:PropertyName>the_geom</ogc:PropertyName><gml:Point><gml:coordinates>'+lonlatxy+'</gml:coordinates></gml:Point></ogc:Contains></ogc:Filter></gml:featureMember></wfs:FeatureCollection>',<br>
//WIDTH:
map.size.w,<br>
//HEIGHT:
map.size.h<br>
},<br>
"<a href="http://localhost:8080/geoserver/wfs" target="_blank">http://localhost:8080/geoserver/wfs</a>"<br>
);<br><br>Thanks in advance<br><br><br>
<div class="gmail_quote">2008/10/28 Eric Lemoine <span dir="ltr"><<a href="mailto:eric.c2c@gmail.com" target="_blank">eric.c2c@gmail.com</a>></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'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 <<a href="mailto:indika85@gmail.com" target="_blank">indika85@gmail.com</a>>:<br>
<div>
<div></div>
<div>> Thanks for the reply.<br>><br>> It seems that
when I click within the marker, I get different lon, lat<br>>
values.<br>><br>> Is it necessary to bind the markers to something
?<br>><br>> Also with the extractAttributes:true, how can I access the
attributes of the<br>> feature ?<br>><br>> Regards,<br>>
Indika<br>><br>> 2008/10/27 Arnd Wippermann <<a href="mailto:arnd.wippermann@web.de" target="_blank">arnd.wippermann@web.de</a>><br>><br>>>
you can use a select control for the wfs layer.<br>>><br>>>
<a href="http://openlayers.org/dev/examples/select-feature-openpopup.html" target="_blank">http://openlayers.org/dev/examples/select-feature-openpopup.html</a><br>>><br>>>
If you have load the wfs layer with extractAttributes: true, then your
wfs<br>>> data are saved in the attributes of the
features.<br>>><br>>> Arnd Wippermann<br>>><br>>>
------------------------------<br>>> *Von:* <a href="mailto:users-bounces@openlayers.org" target="_blank">users-bounces@openlayers.org</a>
[mailto:<a href="mailto:users-bounces@openlayers.org" target="_blank">users-bounces@openlayers.org</a>]<br>>>
*Im Auftrag von *Indika Tantrigoda<br>>> *Gesendet:* Montag, 27. Oktober
2008 16:17<br>>> *An:* OpenLayers users mailing list<br>>>
*Betreff:* [OpenLayers-Users] WFS Layers, Markers,
Popups<br>>><br>>> Hi,<br>>> I have a wfs layer that
displays points on my map, using markers.<br>>> I would like to have a
popup that displays data regarding the point which<br>>> would get
activated for a click event.<br>>><br>>> I tried the following
but, it seems to return all the data regarding the<br>>> wfs layer, not
the single point, irrespective of<br>>> where I click on the
map.<br>>><br>>> wfs_cities.events.register('click', map,
function (e) {<br>>>
document.getElementById('nodelist').innerHTML =<br>>>
"Loading...<br>>> please wait...";<br>>>
var url =
map.layers[2].getFullRequestString(<br>>>
{<br>>>
REQUEST:
"GetFeature",<br>>>
EXCEPTIONS:
"application/vnd.ogc.se_xml",<br>>>
BBOX:
map.getExtent().toBBOX(),<br>>>
X: e.xy.x,<br>>>
Y: e.xy.y,<br>>>
INFO_FORMAT: 'text/html',<br>>>
QUERY_LAYERS: map.layers[2].params.LAYERS,<br>>>
FEATURE_COUNT:
50,<br>>>
WIDTH: map.size.w,<br>>>
HEIGHT:
map.size.h<br>>>
},<br>>>
"<a href="http://localhost:8080/geoserver/wfs" target="_blank">http://localhost:8080/geoserver/wfs</a>"<br>>>
);<br>>><br>>>
Any ideas how I can get around this ?<br>>><br>>> Thanks in
advance.<br>>><br>>> Regards,<br>>>
Indika<br>>><br>><br></div></div></blockquote></div><br></div></div></div>
</blockquote></div><br>