[OSM-dev] Problem with highlighting routes
Stephan Plepelits
skunk at xover.htu.tuwien.ac.at
Tue Aug 12 18:40:40 BST 2008
Hi everybody!
Maybe you could help me with a little problem.
I'm admin of a Wiki[1] for public transport in Austria where every route
is described (or will be described). Now I added maps to the Wikipages
that show the routes. You can find an example on [2].
I'd like to change the style of the line according to special
attributes, like if the route is going over a bridge or through a
tunnel. Unfortunately I haven't understood the API of OpenLayers enough,
so the tracks disappear if I want to change their style.
The code is:
style_tunnel=new OpenLayers.Style({"strokeWidth":"3", "strokeColor":
"#7f7f7f", fillOpacity: "0" });
for (var i = 0; i < this.features.length; i++) {
if(this.features[i].attributes.tunnel=="yes") {
this.features[i].style=style_tunnel;
}
}
Could you help me solve this problem?
Two more questions:
1. As you can see I'm adding key/value-pairs from the relation to it's
members in getdata.php. It would be easier and nicer if I could access
the data directly in JavaScript. Is there a possibility to access this
data (without downloading it twice - once by OpenLayers and once by the
script)?
2. The map doesn't work with IE7 and Konqueror with some weird errors.
Tested: Firefox 3.0.1, Safari 3.1.2, Opera 9.51
Some more information you might need to help me:
This page is embedded in the Wiki-Pages with an iframe:
http://xover.htu.tuwien.ac.at/~tramway/map/index.php?relation=22494
This is the same page, whereas the code from above is being used. The
tunnel-tracks of the route disappear (they are there but invisible):
http://xover.htu.tuwien.ac.at/~tramway/map/index1.php?relation=22494
The full source code of the scripts:
http://xover.htu.tuwien.ac.at/~tramway/map/index.txt
http://xover.htu.tuwien.ac.at/~tramway/map/getdata.txt
[1] http://wiki.stadtverkehr.at
[2] http://xover.htu.tuwien.ac.at/~tramway/stvkr-a-wiki/index.php/Linie_U1_(Wien)
greetings,
Stephan
PS: Keep up the great work!
--
Seid unbequem, seid Sand, nicht Öl im Getriebe der Welt! - Günther Eich
,---------------------------------------------------------------------.
| Stephan Plepelits, |
| Technische Universität Wien - Studium Informatik & Raumplanung |
| > fsinf.at > tubasis.at > rudolfsheim-fuenfhaus.gruene.at |
| > couchsurfing.org > beutelland.mud.at |
| skunk at xover.htu.tuwien.ac.at - My Blog: http://plepe.twoday.net |
`---------------------------------------------------------------------'
More information about the dev
mailing list