[OpenLayers-Users] How get gpx label?
Christian Bleau
christian.bleau at gmail.com
Wed Jun 27 11:28:55 PDT 2012
Hi Stefan,
It's work very well :-))))))
I'm glad, I'm so glad.
Many Thanks.
Christian
Le 27 juin 2012 à 15:00, Stefan Simon a écrit :
> Hello.
>
> This is my code:
> 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
> })
> });
> 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")
> });
>
>
> On Wed, Jun 27, 2012 at 2:12 PM, christian bleau <christian.bleau at gmail.com> wrote:
> Hi,
>
> Is there someone who can help me to understand how can I get the label
> "name" or "others" from gpx's file?
>
> I try this code without succes ;(
>
> var context = {
> pointLabel: function(feature) {
> return feature.attributes['name'] + " (" +
> feature.attributes['name'] + ")";
> }};
>
> var lgpx = new OpenLayers.Layer.GML("GPX", "http:// ****** test_gpx.gpx", {
> format: OpenLayers.Format.GPX,
> style: {
> strokeColor: "green",
> fillColor: "orange",
> graphicName: "triangle",
> label: "${name}",
> pointRadius: 6,
> strokeWidth: 2,
> strokeOpacity: 0.5,
> fillOpacity: 0.5},
> context: context,
> projection: new OpenLayers.Projection("EPSG:4326")
> });
> map.addLayer(lgpx);
>
> If you have any examples or ways.
>
> Thank a lot.
>
> Christian
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/How-get-gpx-label-tp4984193.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
>
> --
> ______________
> Simon Stefan
Christian
Pof at Bleau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120627/07e53cfd/attachment.html>
More information about the Users
mailing list