Ok. Many thanks again!<br>As I said I'll try it out and provide feedback :-)<br><br>Best regards,<br>Guillermo<br><br><div class="gmail_quote">On Mon, Dec 8, 2008 at 3:18 PM, Adorian Ardelean <span dir="ltr"><<a href="mailto:mynature@gmail.com">mynature@gmail.com</a>></span> 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 Guillermo,<br><br>I have not tried it with a WFS layer, but I think it should work (I infer by looking at other examples on this list).<br>
You may add the control when you initialize the rest of other controls you use. The "..." stands for other controls :-)<br>
<br>I think you have to create the layer before you create the controls for it. Just follow regular init() code as in other OL examples. Then when you want to get a feature info you may use some code to activate the <span style="color: rgb(0, 0, 0);">featureinfocontrol (by click on a form entity, or image etc. associated with a "toggle" function).</span><br>
<br>All the best,<br><font color="#888888">Adorian</font><div><div></div><div class="Wj3C7c"><br><br><br><div class="gmail_quote">On Mon, Dec 8, 2008 at 2:53 PM, Guillermo Lopez Mackinnon <span dir="ltr"><<a href="mailto:gmlopez.mackinnon@gmail.com" target="_blank">gmlopez.mackinnon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hey! Many thanks!<br>That sounds like a great hint and like the correct approach too :-)! <br>
<br>What should I do with the controls variable? Add it to the layer at creation time? <br><br>For example:<br><br><div style="margin-left: 40px;"><div>
<span style="color: rgb(0, 0, 0);">controls = {</span><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">...</span><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">featureinfocontrol: new OpenLayers.Control.SelectFeature(myvectorlayer, {onSelect: featureinfo});</span><br style="color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0);">}</span><br><span style="color: rgb(0, 0, 0);"></span><br><span style="color: rgb(0, 0, 0);"></span></div>
var cities = new OpenLayers.Layer.WFS(<br>
"Cities",<br>
"<a href="http://localhost:8080/geoserver/wfs" target="_blank">http://localhost:8080/geoserver/wfs</a>",<br>
{typename: 'topp:cities'},<br>
{<br>
typename: 'cities',<br>
featureNS: '<a href="http://www.openplans.org/topp" target="_blank">http://www.openplans.org/topp</a>',<br>
extractAttributes: true,<br>
<span style="background-color: rgb(255, 255, 51);">controls: controls</span><br><br>
}<br>
); <br></div>
<br>Is the code above correct? Did I understand correctly or do I have to add this control to the map as the other controls?<br><br>I'll try it out and let you know in case I have any problem. If it works I'll post the solution.<br>
<font color="#888888">
<span style="color: rgb(0, 0, 0);"></span><br><br>Guillermo</font><div><div></div><div><br><br><div class="gmail_quote">On Mon, Dec 8, 2008 at 1:30 PM, Adorian Ardelean <span dir="ltr"><<a href="mailto:mynature@gmail.com" target="_blank">mynature@gmail.com</a>></span> 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 Guillermo,<br><br>Look if you can use:<br><i>feature.attributes["city_name"]</i><br>
<br>example<br><span style="color: rgb(51, 51, 255);">featureinfo = function(feature)</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">{</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">alert(</span><i style="color: rgb(51, 51, 255);">feature.attributes["city_name"])</i>;<br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">}</span><br style="color: rgb(51, 51, 255);"><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">controls = {</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">...</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">featureinfocontrol: new OpenLayers.Control.SelectFeature(myvectorlayer, {onSelect: featureinfo});</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">}</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">...</span><br><br>All the best,<br><font color="#888888">Adorian</font><div><div></div><div><br><br><br><div class="gmail_quote">On Mon, Dec 8, 2008 at 12:37 PM, Guillermo Lopez Mackinnon <span dir="ltr"><<a href="mailto:gmlopez.mackinnon@gmail.com" target="_blank">gmlopez.mackinnon@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks for your reply!<br>Actually, I meant the feature attributes like for instance "city_name", "population" and so on. IŽd like to display some of them when the user clicks on a feature and since I may have several layers, doing it in the way I explained in my initial post it'll be pretty tedious so I'd say it should be some other way (a correct way) of doing this kind of stuff. Am I right?<br>
<br><br>Thanks again for your help!<br><font color="#888888"><br>Guillermo</font><div><div></div><div><br><br><div class="gmail_quote">On Mon, Dec 8, 2008 at 11:40 AM, Adorian Ardelean <span dir="ltr"><<a href="mailto:mynature@gmail.com" target="_blank">mynature@gmail.com</a>></span> 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 Nino,<br><br>Do you mean all nodes of a polygon? If yes, you could explore Vector Formats Example in <a href="http://openlayers.org/dev/examples/" target="_blank">http://openlayers.org/dev/examples/</a> where is shows also how you could output coordinates of a feature in various formats.<br>
<br>All the best,<br>Adorian<br><br><br><div class="gmail_quote">On Mon, Dec 8, 2008 at 11:24 AM, Nino Saturnino Martinez Vazquez Wael <span dir="ltr"><<a href="mailto:nino.martinez@jayway.dk" target="_blank">nino.martinez@jayway.dk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">How can I extract all points for a geometry?<br>
<br>
<a href="http://dev.openlayers.org/releases/OpenLayers-2.7/doc/apidocs/files/OpenLayers/Geometry/Collection-js.html#OpenLayers.Geometry.Collection" target="_blank">http://dev.openlayers.org/releases/OpenLayers-2.7/doc/apidocs/files/OpenLayers/Geometry/Collection-js.html#OpenLayers.Geometry.Collection</a><br>
, do I need to call a field directly?<br>
<br>
<br>
--<br>
-Wicket for love<br>
<br>
Nino Martinez Wael<br>
Java Specialist @ Jayway DK<br>
<a href="http://www.jayway.dk" target="_blank">http://www.jayway.dk</a><br>
+45 2936 7684<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Dr. Adorian Ardelean<br>coordinator of myNature Project<br><br><a href="http://mybiosis.info/nature/portal.php?pagename=firstpage" target="_blank">http://mybiosis.info/nature/portal.php?pagename=firstpage</a> [a Romanian biodiversity-database]<br>
<a href="http://mybiosis.info/nature/portal.php?pagename=adorian" target="_blank">http://mybiosis.info/nature/portal.php?pagename=adorian</a> [CV]<br>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Dr. Adorian Ardelean<br>coordinator of myNature Project<br><br><a href="http://mybiosis.info/nature/portal.php?pagename=firstpage" target="_blank">http://mybiosis.info/nature/portal.php?pagename=firstpage</a> [a Romanian biodiversity-database]<br>
<a href="http://mybiosis.info/nature/portal.php?pagename=adorian" target="_blank">http://mybiosis.info/nature/portal.php?pagename=adorian</a> [CV]<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Dr. Adorian Ardelean<br>coordinator of myNature Project<br><br><a href="http://mybiosis.info/nature/portal.php?pagename=firstpage" target="_blank">http://mybiosis.info/nature/portal.php?pagename=firstpage</a> [a Romanian biodiversity-database]<br>
<a href="http://mybiosis.info/nature/portal.php?pagename=adorian" target="_blank">http://mybiosis.info/nature/portal.php?pagename=adorian</a> [CV]<br>
</div></div></blockquote></div><br>