[Openstreetmap-dev] Cache the whole world.
Immanuel Scholz
immanuel.scholz at gmx.de
Thu Feb 16 14:01:31 GMT 2006
Hi,
> You were proposing a standardised "tile name" and two transforming
> functions:
>
> 1. f(lat,lon,zoom) -> tile name
> 2. f(tile name) -> WMS URL
>
> And you think that function 2 could be implemented using a ~64k lookup
> table, such that the transformation is language independent?
That's the idea. What you get is a deterministic (on all platforms using
the IEEE implementation of floating numbers) function giving you the
coordinates of all tiles the input lat/lon is in :-).
And that's what is needed, I hope?
But unfortunatly 64k table is too small ;'-(
First 64k is only for a maximum zoom level of 16.
Second, I would need a table with 64k *entries*. Each entry has a 16-bit
long key and at least 2 floating values as mapped entry. So for double
precision, the table is at minimum 18*64KB = 1,125MB in size.
Instead of a lookup table for the total result, we could use some
deterministic triangular functions (worst case: own implementation with
tables) to do the same.
If I remmeber correctly, the following would be necessary: log, tan, tan-1
and sinh. And the constant PI.
This would enable to do the same calculation in the three different
languages.
However, "just round the boundary values" could still be an option ;-).
We can decide what is cool when the algorithms (without a lookup table)
are implemented in every language. Maybe it is enough to provide the same
PI-constant...
> Now, if you can provide implementations of those functions and the look-up
> table in Java, Ruby and Javascript, I think it could work.
Hm.. I have no experience in Javascript and almost no in ruby. But I'll
give you a Java implementation this evening (haven't a compiler to test it
here) and I bet Steve can extract ruby code out of it in no time! :-).
Ciao, Imi.
More information about the dev
mailing list