Hello,<br><br>the file in this mail displays waypoints from a gpx file.<br><strong><br></strong>Special features:<br>- auto-zoom<br>- auto-center<br><br>What do I need to change to get a popup when clicking a waypoint?<br>
<strong><br></strong>The popup should show "name" and "desc".<br><br>Thanks,<br>Jan<br><br>Waypoints look like this:<br><br><wpt lat="49.123456789" lon="8.123456789"><br> <ele>170.555686</ele><br>
<time>2009-08-01T17:29:29Z</time><br> <name>00000001</name><br> <cmt>00000001</cmt><br> <desc>00000001</desc><br></wpt><br><br><br>Page:<br><pre><html><br>
<head><br>
<title>I want popups!</title><br><br> <script src="<a href="http://www.openlayers.org/api/OpenLayers.js">http://www.openlayers.org/api/OpenLayers.js</a>"></script><br> <script src="<a href="http://www.openstreetmap.org/openlayers/OpenStreetMap.js">http://www.openstreetmap.org/openlayers/OpenStreetMap.js</a>"></script><br>
<br> <script type="text/javascript"><br> var map;<br> function init() {<br> map = new OpenLayers.Map ("map", {<br> controls:[<br> new OpenLayers.Control.Navigation(),<br>
new OpenLayers.Control.PanZoomBar(),<br> new OpenLayers.Control.LayerSwitcher(),<br> new OpenLayers.Control.Attribution()],<br> maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),<br>
maxResolution: 156543.0399,<br> numZoomLevels: 19,<br> units: 'm',<br> projection: new OpenLayers.Projection("EPSG:900913"),<br>
displayProjection: new OpenLayers.Projection("EPSG:4326")<br> } );<br><br> layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");<br> map.addLayer(layerMapnik);<br>
layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender("Osmarender");<br> map.addLayer(layerTilesAtHome);<br> layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap");<br>
map.addLayer(layerCycleMap);<br><br> var dataExtent;<br> var setExtent = function() {<br> if(dataExtent) {<br> dataExtent.extend(this.getDataExtent());<br> } else {<br> dataExtent = this.getDataExtent();<br>
}<br> map.zoomToExtent(dataExtent);<br> };<br> lgpx = new OpenLayers.Layer.GML (<br> "wpt.gpx (red)",<br> "wpt.gpx",<br>
{ <br> projection: new OpenLayers.Projection("EPSG:4326"),<br> // style: {strokeColor: "red", strokeWidth: 5, strokeOpacity: 0.8},<br>
format: OpenLayers.Format.GPX,<br> }<br> );<br> lgpx.events.register("loadend", lgpx, setExtent); <br> map.addLayer(lgpx);<br>
<br> map.setCenter(null, null);<br> };<br> </script><br> </head><br><br> <body onload="init();"><br> <div style="width:90%; height:90%" id="map"></div><br>
<br> </body><br> </html></pre><br><br>