[OSM-dev] possible changes to osmarender.xsl

Mark Huizer xaa+openstreetmap at dohd.org
Sat Sep 29 16:38:31 BST 2007


80n wrote:
> DVC!  Cool.


Hmm, my 5 minute googling for DVC was not really successful, but I'll assume it's good :-)

I was adviced to see if the osmarender 5 code had already fixed this or might need this as well. Maybe you can tell?

As far as getPathLength is concerned, I have two questions

a. the calculation there seems wrong to me, but it could be on purpose since the real calculation might be hard with xsl's math inabilities. it's calculated:

  * totLat = (sum of absolute lat difference per segment)
  * totLon = (sum of absolute lon difference per segment)
  * totalLength^2 = totLat^2+totLon^2

A simple example shows that that is wrong: take a way of segments with coordinates (0,0),(3,4),(7,7). The length can easily be seen (3-4-5 triangles to the rescue :-) ) 10, but osmarender will result in sqrt(98), which makes the road slightly shorter. Could be on purpose since getPathLength will probably always be less than the real length.

b. I'm trying to also make this recursion treeshaped, instead of using tail recursion so the depth is less, but I don't see a way to return 2 values from a call-template call. Any hints?

Mark




More information about the dev mailing list