queryByAttributes returns 0 every time

Steve Lime Steve.Lime at DNR.STATE.MN.US
Mon Nov 5 15:23:36 PST 2007


One big gotcha with attribute queries is that they use a map's extent as a pre-filter so they are
not really purely attribute based. Make sure that the extent is set broad enough to ensure that 
you're searching the right features.

Steve

>>> On 11/3/2007 at 10:59 PM, in message
<20b31d4d0711032059v1aafba7bsee1d868f1046c2b7 at mail.gmail.com>, Ryan Ollerenshaw
<ryanollerenshaw at GMAIL.COM> wrote:
> On 11/3/07, Ryan Ollerenshaw <ryanollerenshaw at gmail.com> wrote:
>> On 11/3/07, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:
>> > Ryan Ollerenshaw wrote:
>> > > I cant seem to get queryByAttributes to work correctly, I always get 0
>> > > results every time, here is the php code that i am using:
>> > >
>> > > $queryString = "(TEAM_ID > 1)";
>> > > $mroLayer->queryByAttributes('TEAM_ID',$queryString, MS_SINGLE);
>> > > echo "RESULTS: ".$mroLayer->getNumResults()
>> > >
>> > > I have also tried:
>> > > $queryString = "(TEAM_ID > '1')";
>> > > $queryString = "('TEAM_ID' > '1')";
>> > > $queryString = "('[TEAM_ID]' > 1)";
>> > >
>> > > Nothing seems to work, I am using php 5.4.1 and mapserver 4.10.1
>> >
>> > Try:  $queryString = "([TEAM_ID] > 1)";
>> >
>> > -Steve W
>> >
>>
>> $queryString = "([TEAM_ID] > 1)";
>> $queryString = "[TEAM_ID] > 1";
>> $queryString = "('[TEAM_ID]' > 1)";
>> $queryString = "'[TEAM_ID]' > 1";
>>
>> Still no good.
>>
> 
> I changed my filter back to:
> 
> $mroLayer->set("filteritem","gid");
> $mroLayer->setFilter("gid =".$gid."");
> 
> This works file for integers but for some reason strings dont work.
> But i can live with this solution for now.



More information about the MapServer-users mailing list