A demo of Generating Google Tiles With mapserver

Sean Gillies sgillies at FRII.COM
Sat May 7 12:24:47 EDT 2005


Steve,

Don't you mean "help to obfuscate it"? :)

Sweet work, Jon!  Yves Moisan and I need to talk to you about whether
we can use this code in our Plone mapping product.

cheers,
Sean


On May 7, 2005, at 10:18 AM, Stephen Woodbridge wrote:

> Jon,
>
> Very nice demo and performace is very good also. I would be interested
> in converting it to perl/mapscript and help to improve it.
>
> -Steve W.
>
> Jon Saints wrote:
>> I have implemented a demo using python mapscript and
>> mapserver that gives very basic functionality simillar
>> to google maps.
>>
>> I do not pre-render maps at the various scales.
>> mapscale are rendered on the fly and the indiviual
>> tile images are sent directly to the user - never
>> saved on disk.  I know this will cause problems for
>> labeling, but there may be a way around this with some
>> DHTML tricks.
>>
>> Please remember that this demo is running off of my
>> desktop computer over a wifi connection. performance
>> may be very slow and my poor desktop might crash with
>> too many hits. I offer only a proof of concept and
>> welcome coments from the list.
>>
>> Right now the demo only works in Mozilla Firefox (on
>> Win, Linux and OsX).  If you zoom in far enough on the
>> washington DC map you will see aerial photos.
>>
>>
>> Click the "START HERE" button to start the app.
>> http://216.15.56.185:8080/jons/indon/client/test.xul
>>
>> Thanks
>> JOn
>>
>>
>>
>>
>>
>>
>>
>> --- Stephen Woodbridge <woodbri at SWOODBRIDGE.COM>
>> wrote:
>>
>>> Hi all,
>>>
>>> I posted about generating google-like tiles using
>>> mapserver earlier. I
>>> took it to the next step of writing a perl/mapscript
>>> script to compute
>>> the cellsize for each zoom scale and used that to
>>> compute the number of
>>> tiles I would need to generate to cover my map
>>> extents. I thought I
>>> would share the results with you. You can probably
>>> save maybe 20-30% on
>>> the number of tiles if you can recognize all water
>>> only tiles and
>>> eliminate them, but this leaves you with 70-80% of
>>> what looks like
>>> infinity for most of us.
>>>
>>>        Scale   Num Tiles
>>>   ---------- -----------
>>>     50000000         256
>>>      4000000        3072
>>>      1000000       40960
>>>       500000      150784
>>>       150000     1634816
>>>        50000    14586880
>>>        15000   161796096
>>>        10000   363410944
>>>         5000  1453643776
>>>         2700  4984920576
>>>   ---------- -----------
>>>  Total Tiles  6980188160
>>>  Approx. Disk Space (assume 3K per tile) =
>>> 21,443,138,027,520
>>>
>>> SOoooo, it requires about 7 Billion 128x128 tiles
>>> and assuming that the
>>> average tile size is about 3K (the smallest tile
>>> that I have seen google
>>> return) it requires 21 Tera bytes of disk space. It
>>> gets worse!
>>>
>>> If you assume you can generate 1000 tiles minute
>>> (16+/sec) then:
>>>
>>> 6,980,188,160 / 1000 tiles/min / 60 min/hr / 24
>>> hr/day / 365 day/yr =
>>> 13.3 yrs
>>>
>>>   1,000 tiles/min = 13.3 yr =  4847 days
>>>  10,000 tiles/min = 1.33 yr =   485 days
>>> 100,000 tiles/min = 0.13 yr =    49 days
>>>
>>> The only way to do the higher generation rates is in
>>> a highly
>>> distributed environment or you run into I/O bottle
>>> necks both reading
>>> and writing data.
>>>
>>> Oh yeah, I only used 10 zoom scales above, Google
>>> has 15, so you do the
>>> math :)
>>>
>>> An alternative to pre generating the tiles, is
>>> generating them on the
>>> fly as they are need and caching them, then removing
>>> the least used ones
>>> over time. This is a much more complicated scenario
>>> and requires a lot
>>> of additional code to manage them. Also you can not
>>> just generate a
>>> single tile as needed because of the way mapserver
>>> handles dynamic
>>> placement of labels. You would need to generate a
>>> "super" tile of say
>>> 8x8 or 16x16 tiles and chop it into the standard
>>> tiles. I looked at
>>> generating a 16x16 super tile at 2048x2048 pixels
>>> that would get chopped
>>> into 256 tiles for pre-generation, but 6x6 tiles
>>> (768x768 pixels) might
>>> be better for dynamic generation. You would have to
>>> find the sweet spot
>>> where the super tile is large enough to minimize
>>> labeling issues and
>>> small enough the it generates and chops quickly.
>>>
>>> -Steve W.
>>>
>>
>>
>



More information about the mapserver-users mailing list