<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
in feature.attributes I have an empty object. One more problem is
how could i find the LonLat of the selected feature?<br>
<br>
-------- Messaggio originale --------
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Oggetto: </th>
<td>Re: [OpenLayers-Users] Popup over GPX track</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Data: </th>
<td>Tue, 11 May 2010 13:24:13 -0400</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Mittente: </th>
<td>Charles Galpin <a class="moz-txt-link-rfc2396E" href="mailto:cgalpin@lhsw.com"><cgalpin@lhsw.com></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">A: </th>
<td>Francesco <a class="moz-txt-link-rfc2396E" href="mailto:webfrank@tiscali.it"><webfrank@tiscali.it></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>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
> <a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
> <a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>
</pre>
</body>
</html>