I know ways I could implement it; but I'm not sure which way is best.
The problem is how to work out which tiles to remove when the zoom
changes. I guess there's a few options:
1) The tileimages each store references to the tile they're replacing.
When a big tile replaces 4 little tiles, it knows which 4 tiles it
replaces and when that tile has loaded the other tiles are removed.
When all 4 smaller tile overlays on a big tile, the big tile keeps a
reference count or something around and that counts down to 0 at which
point the tile is removed.
Bad stuff: This seems unnecessarily fiddly and expensive - every
on-screen tile needs to store another reference count and an array.
2) When any tile loads we do a scan through all tiles currently on the
screen to see if they can be removed.
Bad stuff: This method has n^2 complexity. If we move to 64
pixels-per-side tiles, it might start getting expensive.
3) When the zoom level changes all previously loaded tiles are moved
to 'the background' of sorts. When all tiles in the foreground have
loaded, everything in the 'background' layer is dumped.
Bad stuff: If the user never lets all the screen tiles load (they
constantly move around, rezoom, etc) then the background set will just
keep growing unbounded.
What do you guys think? I'm not really sure how I should proceed.
-J
On Thu, Oct 2, 2008 at 1:08 PM, olivier brand <obra...@gmail.com> wrote:
> Joseph,
>
> I saw a few improvements in the speed of tile loading since I sent you an
> email on this last week. However, I can still see the zoom not working as
> Google does it, being zooming the bitmap until the user releases the
> fingers. The zoom works for about a fraction of seconds and then stop and
> being replaced by the grey grid.
> Do you think you will get the behavior as expected or are you focusing on
> other things right now?
>
> I believe this would dramatically improve the user experience.
>
> Thanks
>
> B-
>
I've made an open source MSVE map engine available as part of
TouchCode (see http://toxicsoftware.com/touchmap-teaser/ and http://toxicsoftware.com/touchmap/)
. The code needs some loving (esp. in the zoom) but can form the basis
of your map engine.
Jon.
I am not a lawyer, but it is my understanding that using the MSVE tile
server is free for non-commercial use. You'll want to go check the
license agreements and everything before you do so of course.
TouchMap _is_ a work in progress and a lot more needs to be done.
There has been some talk of switching from MS to Google or Yahoo tile
servers. I'd love for someone to help with that.
Jon.
Yahoo, Microsoft, Google and OpenStreetMaps all use the same
coordinate system for their tile images. Each application simply has
its own mapping of tile (int x,y,zoom) to URL.
Here's a tile in openstreetmaps (numbers are zoom/x/y):
http://a.tile.openstreetmap.org/15/30149/19669.png
In google maps (notice x=&y=&z=)
http://mt2.google.com/mt?v=w2.83&hl=en&x=7536&y=4915&z=13&s=Gal
a tile in microsoft maps: (They have their own encoding function which
they document)
http://t0.tiles.virtualearth.net/tiles/r3112301330200.png?g=203&mkt=en-au
in yahoo maps (sadly they don't have detailed maps of sydney): (and
again its x=&y=&z=)
http://us.maps1.yimg.com/us.tile.maps.yimg.com/tl?v=4.1&md=2&x=235&y=-26&z=9&r=1
If you can handle one map system it shouldn't take more than a couple
lines to implement another mapping system.
-J