<div dir="ltr">Hi, I had similar problems trying to download files generated on OpenLayers...here are some solutions I've found:<div> - To generate a .gpx file:<br><div> a) If you don't need to support older browsers, you can use the HTML5 FileAPI to generate a file with the gpx content.</div>
<div> b) Maybe use a Flash fallback, such as Downloadify, to generate the file, if you're ok with some Flash in your page.</div><div> - To download the file:</div><div> 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).</div>
<div> 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.</div>
<div> c) The Downloadify lib allows you to download the file (as expected =]), but again, it's Flash ( =[ ).</div></div><div><br></div><div>I hope that helps (and that the English was clear!). Sorry but I can't help you with the qgis problem, though.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/7/1 <span dir="ltr"><<a href="mailto:cromail@gmx.de" target="_blank">cromail@gmx.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-family:Verdana;font-size:12.0px"><div>Hello List,</div>
<div> </div>
<div>i'm trying to export my feature layer as gpx file. On one Side it seems to work, because i get something like this:</div>
<div><?xml version="1.0"?><br>
<gpx xmlns="<a href="http://www.topografix.com/GPX/1/1" target="_blank">http://www.topografix.com/GPX/1/1</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>" version="1.1" creator="OpenLayers" xsi:schemaLocation="<a href="http://www.topografix.com/GPX/1/1" target="_blank">http://www.topografix.com/GPX/1/1</a> <a href="http://www.topografix.com/GPX/1/1/gpx.xsd" target="_blank">http://www.topografix.com/GPX/1/1/gpx.xsd</a>"><br>
<gpx:trk xmlns:gpx="<a href="http://www.topografix.com/GPX/1/1" target="_blank">http://www.topografix.com/GPX/1/1</a>"><br>
<gpx:name>OpenLayers.Feature.Vector_3254</gpx:name><br>
<gpx:desc>No description available</gpx:desc><br>
<gpx:trkseg><br>
<gpx:trkpt lon="7.406179800059247" lat="51.93181443052624"/><br>
<gpx:trkpt lon="7.405849584041292" lat="51.93169308966569"/><br>
<gpx:trkpt lon="7.402611804857786" lat="51.9305432307448"/><br>
<gpx:trkpt lon="7.4024607964425595" lat="51.93048265696835"/><br>
</gpx:trkseg></div>
<div> </div>
<div>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.</div>
<div> </div>
<div> </div>
<div>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:</div>
<div> </div>
<div>onDownloadGPXClick: function(grid, view, rowIndex, colIndex ){<br>
var routingLayer = this.getMappanel().map.getLayersByName(Constants.routingLayer)[0];<br>
var features = routingLayer.features;<br>
var format = new OpenLayers.Format.GPX({<br>
internalProjection: this.getMappanel().map.baseLayer.projection,<br>
externalProjection: new OpenLayers.Projection("EPSG:4326")<br>
});<br>
gpx = format.write(features);<br>
var a = document.createElement('a');<br>
a.href = 'data:application/gpx+xml;base64;' + base64.encode(gpx);<br>
a.download = 'gpx-export.gpx';<br>
return window.open(a);<br>
},</div>
<div> </div>
<div> </div>
<div>Thanks for any help</div>
<div>Christian</div></div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br></blockquote></div><br></div></div>