Hi, I had similar problems trying to download files generated on OpenLayers...here are some solutions I've found: - To generate a .gpx file: a) If you don't need to support older browsers, you can use the HTML5 FileAPI to generate a file with the gpx content. b) Maybe use a Flash fallback, such as Downloadify, to generate the file, if you're ok with some Flash in your page. - To download the file: a) With a file generated you could then try the solution you're mentioned, by opening it in a new window (not sure if it'd work). b) If you have a server-side support, you could use a technique that sends the file content (maybe through a hidden form) to a web service that adds a "Content-Disposition: attachment" header to the response and return it to the page. That way your browser would open the download popup for the file. c) The Downloadify lib allows you to download the file (as expected =]), but again, it's Flash ( =[ ).
I hope that helps (and that the English was clear!). Sorry but I can't help you with the qgis problem, though. 2013/7/1 <crom...@gmx.de> > Hello List, > > i'm trying to export my feature layer as gpx file. On one Side it seems to > work, because i get something like this: > <?xml version="1.0"?> > <gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" version="1.1" > creator="OpenLayers" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 > http://www.topografix.com/GPX/1/1/gpx.xsd"> > <gpx:trk xmlns:gpx="http://www.topografix.com/GPX/1/1"> > <gpx:name>OpenLayers.Feature.Vector_3254</gpx:name> > <gpx:desc>No description available</gpx:desc> > <gpx:trkseg> > <gpx:trkpt lon="7.406179800059247" lat="51.93181443052624"/> > <gpx:trkpt lon="7.405849584041292" lat="51.93169308966569"/> > <gpx:trkpt lon="7.402611804857786" lat="51.9305432307448"/> > <gpx:trkpt lon="7.4024607964425595" lat="51.93048265696835"/> > </gpx:trkseg> > > On the other side, this track doesn't show up when i load it into qgis. Is > this a version conflict? When i delete the "gpx:" everywhere the gpx shows > up in qgis. But both are valid xml's. > > > The second thing i'm facing at the moment is how to download the gpx file > on the client side after it was generated. Has anyone already a solution > for this? I tried it the following way: > > onDownloadGPXClick: function(grid, view, rowIndex, colIndex ){ > var routingLayer = > this.getMappanel().map.getLayersByName(Constants.routingLayer)[0]; > var features = routingLayer.features; > var format = new OpenLayers.Format.GPX({ > internalProjection: > this.getMappanel().map.baseLayer.projection, > externalProjection: new OpenLayers.Projection("EPSG:4326") > }); > gpx = format.write(features); > var a = document.createElement('a'); > a.href = 'data:application/gpx+xml;base64;' + base64.encode(gpx); > a.download = 'gpx-export.gpx'; > return window.open(a); > }, > > > Thanks for any help > Christian > > _______________________________________________ > Users mailing list > us...@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/openlayers-users > >
_______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users