[mapserver-users] Problem with attribute query, multiple attributes

Jeff McKenna jmckenna at gatewaygeomatics.com
Wed Nov 28 15:41:13 PST 2012


On 12-11-28 5:43 PM, Bistrais, Bob wrote:
> I am trying to set up an attribute query for a large parcel dataset
> (about 550,000 polygons).  I am having trouble with the query exceeding
> the 30 second limit.
> 
>  
> 
> I am trying to query on the map_bk_lot and town attributes.  I can query
> on either one separately and get results, but I need to query on both at
> the same time.
> 
>  
> 
> Here is my query expression:
> 
> $queryExp = "('[TOWN]' == '007-042') AND ('[TOWN]' == 'Acton'))";     
> ---Hardcoded for testing now, will eventually use variables
> 
> $pLayer->queryByAttributes("MAP_BK_LOT",$queryExp,MS_SINGLE);   
> ----Query statement
> 
>  
> 
> The data is in an ESRI File GDB.  I am using MS4w 3.0.4m MapServer
> 6.0.2, MapScript 6.1 for PHP
> 
>  
> 
> One other thing worth mentioning- if I use a small subset of features
> (such as a town), the query will work without timing out.  But I’m no
> longer convinced that dataset size is the problem since it will query on
> one attribute.
> 
>  
> 
> Any ideas what’s going wrong here?

A tip that might come in handy someday, if not in this case, could be to
create an "attribute index" on your vector field (see example in
http://www.gdal.org/ogr/drv_shapefile.html); I've done this before and
it's improved attribute queries in MapServer significantly.  You can
generate one through an ogrinfo command with the "sql" switch.

Sorry I cannot provide exact FileGDB examples at the moment.

-jeff



-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




More information about the mapserver-users mailing list