[OpenLayers-Users] Detecting a click in a feature

Carlos Pinto cmspinto at gmail.com
Fri Feb 22 08:07:07 EST 2008


Hi all,

I was using google maps and last week I decided to use OpenLayers, so I'm
quite a new user.

So now I'm changing all my code to OpenLayers, but I have this problem that
I was adding features from a database and then I was showing the balloons
with the description.

Now I want to show it in a table that it is outside the map. But can anybody
advise me what is the best way to add features from the database (they can
be hundreds of polygons), I have try to use GML and the text file, but once
they are in the map I can not detect when a feature was clicked, I was using
this code:



            function init(){
            var mylayer =   new OpenLayers.Layer.GML("GML",
"../KML/MyPolygon.xml");
               map.addLayer(mylayer);

            selectControl = new OpenLayers.Control.SelectFeature(mylayer,
                {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect});
            selectControl.activate();
          }


But doens't work, does anybody knows why?

And just one last thing, is this the best way to add hundreds of features to
the map?

Thanks in advance

Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080222/288b9cb1/attachment.html


More information about the Users mailing list