Hello.<br><br>This is my code:<br><pre>var gpxStyles = new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
pointRadius: "5", // sized according to type attribute
label: "${name}",
labelAlign: 'cb',
fontSize: 9,
fontFamily: "Arial",
fontColor: "red",
labelYOffset: 6,
fillColor: "brown",
strokeColor: "yellow",
strokeWidth: 2,
strokeOpacity: 1
}),
"select": new OpenLayers.Style({
fillColor: "#66ccff",
strokeColor: "#3399ff",
graphicZIndex: 2
})
}); <br></pre><pre>var __gpx_layer = new OpenLayers.Layer.Vector("gpx_layer", {
protocol: new OpenLayers.Protocol.HTTP({
url: "path_to_gpx/gpx_file.gpx",
format: new OpenLayers.Format.GPX({extractWaypoints: true, extractRoutes: false, extractAttributes: true})
}),
strategies: [new OpenLayers.Strategy.Fixed()],
visibility: false,
styleMap: gpxStyles,
projection: new OpenLayers.Projection("EPSG:4326")
});</pre><br><br><div class="gmail_quote">On Wed, Jun 27, 2012 at 2:12 PM, christian bleau <span dir="ltr"><<a href="mailto:christian.bleau@gmail.com" target="_blank">christian.bleau@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Is there someone who can help me to understand how can I get the label<br>
"name" or "others" from gpx's file?<br>
<br>
I try this code without succes ;(<br>
<br>
var context = {<br>
pointLabel: function(feature) {<br>
return feature.attributes['name'] + " (" +<br>
feature.attributes['name'] + ")";<br>
}};<br>
<br>
var lgpx = new OpenLayers.Layer.GML("GPX", "http:// ****** test_gpx.gpx", {<br>
format: OpenLayers.Format.GPX,<br>
style: {<br>
strokeColor: "green",<br>
fillColor: "orange",<br>
graphicName: "triangle",<br>
label: "${name}",<br>
pointRadius: 6,<br>
strokeWidth: 2,<br>
strokeOpacity: 0.5,<br>
fillOpacity: 0.5},<br>
context: context,<br>
projection: new OpenLayers.Projection("EPSG:4326")<br>
});<br>
map.addLayer(lgpx);<br>
<br>
If you have any examples or ways.<br>
<br>
Thank a lot.<br>
<br>
Christian<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/How-get-gpx-label-tp4984193.html" target="_blank">http://osgeo-org.1560.n6.nabble.com/How-get-gpx-label-tp4984193.html</a><br>
Sent from the OpenLayers Users mailing list archive at Nabble.com.<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>
</blockquote></div><br><br clear="all"><br>-- <br>______________<br>Simon Stefan<br>