layer.queryByPoint( ) and layer.open( ) interoperation

Rhys Ickeringill rhysi at OMNILINK.COM.AU
Mon May 23 20:40:11 EDT 2005


Hi List,

Is the following an undocumented feature or a bug?

I had Mapscript code which looked something like:

layer = map.getLayerByName( name )
layer.open( )

for( i = 0; i < points.length(); ++i ){

    if( layer.queryByPoint( points[i], MS_SINGLE, 0 ) ){
        result = layer.getResult( 0 )
        shp = layer.getShape( result.tileindex, result.shapeindex )
        info = shp.values
        }
    }

layer.close( )

But kept getting the MapServer errors to the effect "layer has not been
opened" on the call to layer.getShape( ). Playing with it, I found that the
following code gave the functionality I was after:

layer = map.getLayerByName( name )

for( i = 0; i < points.length(); ++i ){

    if( layer.queryByPoint( points[i], MS_SINGLE, 0 ) ){
        layer.open( )
        result = layer.getResult( 0 )
        shp = layer.getShape( result.tileindex, result.shapeindex )
        info = shp.values
        layer.close( ) // possibly redundant
        }
    }

This leads me to believe that each call to layer.queryByPoint( ) is having
the effect of layer.close( ). So - bug or feature?

Regards,

Rhys



More information about the mapserver-users mailing list