Hi,
in feature.attributes I have an empty object. One more problem is how could i find the LonLat of the selected feature?

-------- Messaggio originale --------
Oggetto:        Re: [OpenLayers-Users] Popup over GPX track
Data:   Tue, 11 May 2010 13:24:13 -0400
Mittente:       Charles Galpin <[email protected]>
A:      Francesco <[email protected]>



Francesco, the feature attributes will be in feature.attributes 
(feature.attributes.name etc)

hth,
charles

On May 11, 2010, at 12:43 PM, Francesco wrote:

 Hi,
     I'm trying to display a popup on mouse over GPX track. This is the
 code used to load the track:

 var lgpx = new OpenLayers.Layer.Vector("Track", {
                 style: {strokeColor: 'red', strokeWidth: 10,
 strokeOpacity: 0.5},
                 projection: map.displayProjection,
                 strategies: [new OpenLayers.Strategy.Fixed()],
                 protocol: new OpenLayers.Protocol.HTTP({
                     url: 'gpx.php',
                     format: new OpenLayers.Format.GPX()
                 })
             });

             map.addLayer(lgpx);

             lgpx.events.register('loadend',lgpx,function() {
                 var bounds = this.getDataExtent();
                 map.zoomToExtent(bounds);
             });
             var hoverSelect = new OpenLayers.Control.SelectFeature(lgpx, {
                 hover: true,
                 onSelect: function(feature) {

 -------------->  Here I want to display a popup with info from the GPX file

                 },
                 onUnselect: function(feature) {
                         if (feature.popup) {
                         map.removePopup(feature.popup);
                         feature.popup.destroy();
                         delete feature.popup;
                     }
                 }
             });
             map.addControl(hoverSelect);
             hoverSelect.activate();

 I cannot find a way to get the currently selected track segment and
 extract attributes to display inside the popup.

 Any idea?

 Tnx
 Francesco
 _______________________________________________
 Users mailing list
 [email protected]
 http://openlayers.org/mailman/listinfo/users



_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to