Using Mapserver to generate google like tiles

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Thu May 5 11:55:58 PDT 2005


Frank Warmerdam wrote:
> On 5/5/05, Paul Ramsey <pramsey at refractions.net> wrote:
>
>>I think there is a more elegant solution to the "google maps speedup"
>>problem:
>>
>>- The reason google maps is "fast" is because (a) they restrict
>>themselves to fixes scales in their UI and (b) they load in the map in
>>parallel chunks of 128x128 size.
>>
>>So the answer:
>>
>>- Write a google maps style client that forces a limited number of fixed
>>scales, and always generates tiled WMS requests using the same
>>coordinates for each tile.
>>- Place a caching proxy between your Mapserver and the world, and tell
>>your client to always make requests to the caching proxy.
>>
>>Most of the work is doing the fancy google maps style javascript client.
>
>
> Paul,
>
> I like the idea of just using a conventional http proxy caching system.
> However, I don't think your approach fully addresses the concern of
> continuity between tiles.  Due to the label placement logic of MapServer
> it is very hard to be sure that multiple "tile" requests by WMS will have
> compatible label placement which results in chopped off labels, and
> other anomolies from a straightforward use of mapserver for generating
> the tiles. I think the idea of generating a much bigger region and either
> just cutting out the center, or cutting up bigger regions would give much
> better continuity between tiles.
>
> Forgive me if I am stating the obvious.

Frank, this is exactly my concern. I know for a fact that Google has
labels split across tile boundaries. I also restrict my browser client
to fixed scales. I think what I want to do is create a Perl/mapscript
utility that generates large tiles, like some multiple of the unit tile
size and then pass it to Image::Magick and chop it into until tiles.
And also detect and eliminate all tiles the are ONLY water.

So if my tile is 128x128 then I might want to generate an image of
2048x2048 and chop it into 16x16=256 tiles of 128x128 pixels. And if all
label are set to PARTIAL FALSE then the 64 outer edges will not have
labels crossing them so it should not be noticeable.

My problem(s) with moving forward are:
1) setting up the math and tile names - trivial for DD, needs to be done
2) should I use a projection like equirectangular
3) working in the projection confuses the map for me

Any thoughts on this?
   -Steve

Some stats from a www.blogger.com on this are

An image of the whole of mainland USA leeched from google maps  zoom
level 11. 448 tiles leeched and stitched together via perl.

the (0,0) tile is located at about the centre of Kansas.

Each zoom level increases the resolution by 2 (and hence the number of
tiles goes up by 4).

Zoom - Number of tiles for mainland USA
13 - 28
12 - 112
11 - 488
8 - 28672
1 - 469762048 (at 1 tile per second, this will take about 14 years to
leech off the site. The final image, if I had the time to leech it,
would have a resolution of about 7million * 4million pixels)



More information about the MapServer-users mailing list