<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
If you are providing a StyleMap to the layer, you should drop the
'style' property in the layer definition.<br>
<br>
Matt Priour<br>
<br>
<br>
<div class="moz-cite-prefix">On 12/14/2012 8:33 AM, Digby Maass
wrote:<br>
</div>
<blockquote cite="mid:CCF0E92B.89F0%25digbymaass@gmail.com"
type="cite">
<title>display waypoints from a gpx file</title>
<font face="Calibri, Verdana, Helvetica, Arial"><span
style="font-size:11pt">I can display a gpx trace on a map eg:<br>
<br>
<a moz-do-not-send="true"
href="http://www.carnethy.com/maps/wed_training/iframecontent/121212nightrun.htm">http://www.carnethy.com/maps/wed_training/iframecontent/121212nightrun.htm</a>
(attached)<br>
<br>
But I can't work out how to display waypoints with their
names. Can anyone help?<br>
<br>
Nothing happens if I change this: <br>
var lgpx = new OpenLayers.Layer.Vector("wed training", {<br>
strategies: [new OpenLayers.Strategy.Fixed()],<br>
protocol: new OpenLayers.Protocol.HTTP({<br>
url:
"../../gpx/wed-training/12-Dec-12.gpx",<br>
format: new OpenLayers.Format.GPX()<br>
}),<br>
style: {strokeColor: "red", strokeWidth: 3,
strokeOpacity: 0.8},<br>
projection: new
OpenLayers.Projection("EPSG:4326") <br>
});<br>
<br>
to this:<br>
<br>
var lgpx = new OpenLayers.Layer.Vector("wed training", {
<br>
strategies: [new OpenLayers.Strategy.Fixed()],
<br>
protocol: new OpenLayers.Protocol.HTTP({
<br>
url:
"../../gpx/wed-training/12-Dec-12.gpx", <br>
format: new
OpenLayers.Format.GPX({extractWaypoints: true, extractRoutes:
true, extractAttributes: true})
}), <br>
style: {strokeColor: "red", strokeWidth: 3,
strokeOpacity: 0.8}, <br>
styleMap: gpxStyles, <br>
projection: new
OpenLayers.Projection("EPSG:4326") });<br>
<br>
and define gpxStyles thus:<br>
<br>
var gpxStyles = new OpenLayers.StyleMap({"default": new
OpenLayers.Style({ pointRadius:
"5", // sized according to type attribute
label: "${wpt}",<br>
labelAlign: 'cb', <br>
fontSize: 9, <br>
fontFamily: "Arial", <br>
fontColor: "red", <br>
labelYOffset: 6, <br>
fillColor: "brown", <br>
strokeColor: "yellow", <br>
strokeWidth: 2, <br>
strokeOpacity: 1 <br>
}), <br>
"select": new OpenLayers.Style({fillColor: "#66ccff",
strokeColor:
"#3399ff",graphicZIndex: 2<br>
}) <br>
}); <br>
<br>
Thanks<br>
Digby</span></font>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
</blockquote>
<br>
</body>
</html>