I have a gpx file that looks like this: https://gist.github.com/trufa/6924353
I went through the OL track example ( http://wiki.openstreetmap.org/wiki/Openlayers_Track_example): var lgpx = new OpenLayers.Layer.Vector("Lakeside cycle ride", { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: "around_lake.gpx", format: new OpenLayers.Format.GPX() }), style: {strokeColor: "green", strokeWidth: 5, strokeOpacity: 0.5}, projection: new OpenLayers.Projection("EPSG:4326") }); map.addLayer(lgpx); And the above code draws the route correctly, I just did that to test that everything was working correctly. My objective here to use OpenLayers to parse the gpx files and extract the coordinates. <wpt lon="15.428824518436" lat="47.071922203043"></wpt> <wpt lon="15.424404237975" lat="47.071366853467"></wpt> <wpt lon="15.423460100401" lat="47.068677710511"></wpt> <wpt lon="15.427107904664" lat="47.068970015231"></wpt> <wpt lon="15.428781603085" lat="47.070957644813"></wpt> <wpt lon="15.430755708927" lat="47.071016103385"></wpt> <wpt lon="15.430326555481" lat="47.072068346707"></wpt> <wpt lon="15.431141947021" lat="47.072068346707"></wpt> <wpt lon="15.430884454953" lat="47.074114315917"></wpt> That I need to feed to a custom made function. I've been trying all sort of things unsuccessfully. >From the docs: http://dev.openlayers.org/docs/files/OpenLayers/Format/GPX-js.html The the extractWaypoints seems to be what I need. I tried: format: new OpenLayers.Format.GPX( { extractWaypoints: true } ) But when I do console.log(lgpx) I get a HUGE object where I can't even find where the coord are so, so I wouldn't even know how to loop it. To sum up, I would need an array (or something) with the coordinates of the waypoints in the gpx files which sounds simple enough but I can't manage it. Thanks in advance!
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
