OK - here is what works:
Once I have read in the local GPX file into memory, I have a function that
creates the Vector layer:
var gpx_format = new OpenLayers.Format.GPX({externalProjection: new
OpenLayers.Projection('EPSG:4326'),
internalProjection: new OpenLayers.Projection('EPSG:2193')});
var reader = new FileReader();
reader.onload = function(event) {
var contents = event.target.result;
//alert(contents);
var olgpx = gpx_format.read(contents);
var gpxl = new OpenLayers.Layer.Vector("GPX Points",
{isBaseLayer: false,
styleMap: gpxStyles,
rendererOptions: {zIndexing: true},
extractAttributes: true });
gpxl.addFeatures(olgpx);
alert("added " + gpxl.features.length + " features to layer");
map.addLayer(gpxl);
alert("added gpx layer to map");
map.zoomToExtent(gpxl.getDataExtent());
};
Kind regards,
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
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users