Caching query result?

Frederico Lucca fredlucca at GMAIL.COM
Fri Aug 19 12:06:30 EDT 2005


Lorenzo,

I have a source in java.
It's important when you invoke, to set the scale as the same you are in the map.
It works fine.

public shapeObj getInfo(String name, double x, double y, int range){
        
        shapeObj shape = null;
        pointObj point = new pointObj(x,y,0);
        layerObj layer = map.getLayerByName(name);
        layer.setTemplate("whatever");
        layer.setSizeunits(mapscript.MS_METERS);
        layer.setToleranceunits(mapscript.MS_METERS);
        layer.setTolerance(range);
        
        if(layer.queryByPoint(map, point, mapscript.MS_SINGLE,
-1)==mapscript.MS_SUCCESS){
            
            resultCacheObj results = layer.getResults();
            
            if (results.getNumresults()>0){
                
                layer.open();
                
                resultCacheMemberObj result = results.getResult(0);
                
                shape=new shapeObj(layer.getType());
               
layer.getShape(shape,result.getTileindex(),result.getShapeindex());
                
                layer.close();
                
            }
        }
        
        return shape;
}

On 8/19/05, Dott. Lorenzo Panarello - ZENIT S.A.
<lorenzo.panarello at zenit-sa.com> wrote:
> Hi Listers,
> 
> I have a trouble with query results. My application works with 4.7 version
> of mapserver in a frame layout: query results in a query frame and map
> drawing in a map frame. When I fire a query the first time all works fine
> but the following queries always return the same result even if I query
> another feature in the same map. It seems I have to zoom or pan to another
> map area to make queries work again. I also noticed a strange behaviour of
> TOLERANCE and TOLERANCEUNITS directives: I catch too many "Search returned
> no results" errors also clicking exactly on the queried feature... maybe
> the
> 2 problems are correlated?? Anyone can help me?
> Does anyone know if there is some query caching process or initialize
> method??
> 
> Thanks in advance...
> 
> Lorenzo
> 
> Dott. Lorenzo Panarello 
> lorenzo.panarello at zenit-sa.com 
> -----------------------------------------------------------------------
> Studio Associato Zenit 
> Cartografia e Sistemi Informativi per l'Ambiente ed il Territorio 
> Vicolo Molino 2, Busto Arsizio (VA) 
> web - www.zenit-sa.com 
> mail - info at zenit-sa.com 
> ----------------------------------------------------------------------------
> -------------
>  
> 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.10.12/77 - Release Date: 18/08/2005
>  
> 


-- 
"Everything under the sun is in tune
But the sun is eclipsed by the moon"



More information about the mapserver-users mailing list