[OpenLayers-Users] Loading a local GPX file into an OpenLayers Vector layer
Robert Sanson
Robert.Sanson at asurequality.com
Wed Apr 17 15:28:52 PDT 2013
I am developing an application that would allow a user to use HTML5 File API to browse for and read a local GPX file. So far, so good, I am doing this. Now I want to add the file contents to a new Vector layer and add it to the map. The GPX data is in WGS84 (EPSG:4326), and my map is in New Zealand Transverse Mercator (EPSG:2193).
What OpenLayers protocol settings can I use to pass the file contents to the OpenLayers GPX reader?
This code works if I have one of the GPX files in my htdocs directory:
var wgs84 = new OpenLayers.Projection("EPSG:4326");
map.addLayer(new OpenLayers.Layer.Vector("GPX Vectors", {
styleMap: gpxStyles,
eventListeners: {
"featuresadded": function(event) {
// 'this' is layer
this.map.zoomToExtent(this.getDataExtent());
}
},
projection: wgs84,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "deer 5-10-12.gpx",
format: new OpenLayers.Format.GPX()
})
}));
But I want to point the url to the file in memory of the client browser, or use some other approach.
Any help would be appreciated.
Many thanks,
Robert Sanson
This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.
This message has been scanned for Malware and Viruses by Websense Hosted Security.
www.websense.com
More information about the Users
mailing list