[ka-Map-users] Interesting Problem for precaching

Paul Spencer pspencer at dmsolutions.ca
Wed Jul 5 11:39:13 EDT 2006


Steve,

I'll defer to Daniel's knowledge of mapserver/mapscript in this  
case.  I think the best approach would be to develop a precaching  
technique that could read a vector or raster file and use that to  
determine which tiles to generate.

I think a raster is a natural fit and you could set it up so that a  
single pixel represents a meta tile.  If the pixel has a certain  
value then you know what to do with it.  Actions could be:

generate - generate the meta tile
ocean - mark the meta tile as ocean with no features
land - mark the meta tile as land with no features
nodata - mark the meta tile as having no data

A separate process could be run to generate these rasters, even using  
mapserver, for each scale.

This implies an update to tile.php (or tile.pl in your case :)) which  
would be able to identify a meta tile being marked as ocean/land/ 
nodata and returning the appropriate image.

Cheers

Paul

On 4-Jul-06, at 11:37 AM, 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.
>
> 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.
>
> I think the real solution is a smart precache script that hits only  
> the areas that are expected to have data.
>
> Daniel
> -- 
> Daniel Morissette
> http://www.mapgears.com/
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+






More information about the ka-Map-users mailing list