[ka-Map-users] Interesting Problem for precaching
Stephen Woodbridge
woodbri at swoodbridge.com
Tue Jul 4 14:58:29 EDT 2006
Daniel Morissette wrote:
> Stephen Woodbridge wrote:
>>
>> Any thoughts on how we might be able to do this?
>> Is there a way to get mapscript to return a flag like:
>>
>> $img = $oMap->draw();
>> if ($img->didDrawObjects()) {
>> // split the meta tile
>> } else {
>> // mark the metatile as empty
>> }
>>
>> such it would return ture/false if it draws any objects.
>>
>
> No. There is currently no way in MapServer to know if any shapes were
> drawn in a given map. A way to implement this could be to carry a
> counter of number of shapes drawn at the class level (e.g.
> $class->numShapesDrawn or $clas->numhits), and then provide methods at
> the layer and map level to compute the total for a given layer or the
> whole map (e.g. $layer->getNumShapesDrawn()). This would also allow for
> things like showing only visible classes in a legend, but as was raised
> in a previous discussion on this topic, the contents of the legend would
> be valid only if it is generated after rendering the map so the value of
> this feature is arguable.
So what you are saying is that there is limited value in having a
granular accounting of stuff that is drawn, but for ka-map there would
be a value to just know if anything was drawn. See below.
> Note that even with such a counter you may not get the results that you
> expected in your case since water areas such as Hudson's Bay overlap
> with the MBR of the country outline (polygon) that you are likely
> drawing in your map, so even if you don't see any land, the bay itself
> overlaps with the land polygon and I believe MapServer attempts to draw
> it anyway even if it doesn't generate any pixel on the map image. The
> same may be true of most areas on the shore of a continent that fall
> within the MBR of the continent's polygon in the projection of your map.
Even this would not be a bad. Hudson Bay is only about 5% of the 30%
that I would expect to be ocean tiles, so there would still be a
significant savings.
> I think the real solution is a smart precache script that hits only the
> areas that are expected to have data.
Exactly the reason for my inquiry. I am proposing at least one smart way
of doing just that and integrating it with ka-map. Since there are not
any other proposals on the table, and I would welcome some other ideas,
it is the only proposal. :)
One of the problems with a smart way of doing it is that things are
highly dependent on the mapfile as to what may or may not be drawn for
any given scale and location. Since mapserver needs to go through the
process of evaluating and rendering the tile to really assess if
anything was draw, it would be nice if a simple drawn/not_drawn flag was
propagated and made available.
Why is this valuable to ka-map users?
For 12 scale ka-map site covering US and Canada:
total tiles 312,754,150
tiles under 500 bytes: 250,208,896
If you assume 30% of the total tiles are ocean tiles then 93,826,245
tiles times 4096 bytes per cluster = 384,312,299,520 which is 384 GB of
disk to store empty ocean tiles that could be saved!!!
This is a significant savings, especially if you multiply it by all
ka-map installations, even if they only get some percentage of that saving.
-Steve
More information about the ka-Map-users
mailing list