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

Sean Gillies sgillies at FRII.COM
Mon May 23 19:18:38 PDT 2005


On May 23, 2005, at 6:40 PM, Rhys Ickeringill wrote:

> 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
>

Bug. http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1175.

Sean


--
Sean Gillies
sgillies at frii dot com
http://zcologia.com



More information about the MapServer-users mailing list