[OpenLayers-Users] Fwd: Re: Popup over GPX track
Francesco
webfrank at tiscali.it
Wed May 12 04:18:39 EDT 2010
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 <cgalpin at lhsw.com>
A: Francesco <webfrank at tiscali.it>
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
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100512/a3105ebd/attachment.html
More information about the Users
mailing list