[OpenLayers-Users] How get gpx label?

christian bleau christian.bleau at gmail.com
Wed Jun 27 11:29:24 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 [via OSGeo.org] 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 <[hidden email]> 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
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 
> 
> 
> -- 
> ______________
> Simon Stefan
> 
> _______________________________________________ 
> Users mailing list 
> [hidden email] 
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://osgeo-org.1560.n6.nabble.com/How-get-gpx-label-tp4984193p4984219.html
> To unsubscribe from How get gpx label?, click here.
> NAML

Christian

Pof at Bleau









--
View this message in context: http://osgeo-org.1560.n6.nabble.com/How-get-gpx-label-tp4984193p4984332.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120627/08bf2c47/attachment-0001.html>


More information about the Users mailing list