[OpenLayers-Users] seeking advice to orient image on layer

Arnd Wippermann arnd.wippermann at web.de
Tue Mar 30 13:44:54 EDT 2010


Hi,
 
"${angle}" will expand to aFeature.attributes.angle. Add this attribute to
your features, then your styleMap should do the rest.
 
Arnd
 

  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von David Hine
Gesendet: Dienstag, 30. März 2010 15:11
An: users at openlayers.org
Betreff: [OpenLayers-Users] seeking advice to orient image on layer



Dear OL List

I am seeking assistance to orient an arrow image on a layer using the latest
wind direction record in a MySQL database.

 

I have a php file printing the value of the direction and I reference it by
its location
 but this is not successful.

 

Your suggestions would be very welcome.

Thanks

David Hine

 

Snip
.

vectors = new OpenLayers.Layer.Vector(

                "Wind Direction",

                {

                    styleMap: new OpenLayers.StyleMap({

                        "default": {

                            externalGraphic: "img/windarrow.png",

                            //graphicWidth: 17,

                            graphicHeight: 67,

                            graphicYOffset: -33,

                            rotate: "${angle}",

                            fillOpacity: "1"

                        },

                        "select": {

                            cursor: "crosshair",

                            externalGraphic: "img/marker.png"

                        }

                    })

                }

            );

            

             map.addLayer(vectors);

            

            var features = [];

            var x = 145.85318;

            var y = -17.53748;

            var angle = {location: "./txtgen_wind_dir.php"}

             rotate: "${angle}",

             origin = (x, y),

             

                features.push(

                    new OpenLayers.Feature.Vector(

                        new OpenLayers.Geometry.Point(x, y), {angle:
"${angle}", origin: (x, y)

                        }

                    )

                );                   

                vectors.addFeatures(features);

 

snip
.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100330/e252b61c/attachment.html


More information about the Users mailing list