[OpenLayers-Users] Fwd: Re: Popup over GPX track
Jan Tappenbeck
osm at tappenbeck.net
Wed May 12 05:49:56 EDT 2010
Am 12.05.2010 10:18, schrieb Francesco:
> 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
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
look at http://wiki.openstreetmap.org/wiki/User:MHohmann
More information about the Users
mailing list