Hi, I'm trying to load in some data in OSM format into a Vector layer. The OSM data (not actual OpenStreetMap data, but data from my own project for which I'm using OSM format) contains a mixture of nodes and ways, e.g.:
http://www.free-map.org.uk/otv/route.php?action=get&bbox=-2,50,-1,51&format=osm I use a Vector layer with a BBOX strategy and OpenLayers.Format.OSM. The problem comes with the styling.I want ways to be drawn as blue lines, and nodes as camera icons. When the data from the server contains just nodes, everything is fine - the nodes are styled how I want them to be (with a camera icon, rotated according to the "direction" attribute). However, when the layer contains ways as well as nodes, there is a problem: the ways are drawn (if specified in the style map) but the nodes are not. If you go to http://www.free-map.org.uk/otv/ and turn off the "OTV Panoramas" layer, you can see what I mean - the camera icons disappear, yet they should be in the "Routes" layer as well as the "OTV Panoramas" layer. (The "Routes" layer contains the OSM-format data) The styles I've tried are as follows. This one is an attempt to style both lines (ways) and nodes: var lgstyle = { strokeWidth: 5, strokeColor: 'blue', strokeOpacity: 0.6 , externalGraphic: 'images/cam.png', graphicWidth: 16, graphicHeight: 16 }; while this one styles nodes only: var style =new OpenLayers.Style ({ externalGraphic: 'images/cam.png', graphicWidth: 16, graphicHeight: 16 rotation: "${getRotation}" }, // rotation determined by "direction" attribute { context: ctxt } ); The first style, when specified in the style map, will draw only ways. The second one will draw nothing if there are nodes and ways in the OSM data sent back from the server, *but* will draw the nodes as camera icons *if* there are only nodes in the feed from the server. I've also tried using addUniqueValueRules() to style features differently depending on whether they are a node or a way (using a tag which is set to "node" for nodes and "way" for ways) but this has a similar effect - ways are styled, but nodes are not. All the working OSM vector layer examples I've seen use older, deprecated code making use of OpenLayers.Layer.GML. Can anyone give any pointers on this? If anyone needs to look at the code it's at http://www.free-map.org.uk/otv/main.js. Thanks, Nick _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users