Question on queryByAttributes - multiple fields

Cord Thomas cord at LUPINEX.COM
Mon Nov 29 20:15:02 EST 2004


Hey Sean

Thank you for this definitive answer.  I have a few observations:

1 - as i said, if i see the query dump from mapserver when i forgot to
give my account select permissions, i saw the following statement:

DECLARE mycursor BINARY CURSOR FOR SELECT
stateid,name::text,asbinary(force_collection(force_2d(wkb_geometry)),'NDR'),OID::text
from incorpbound WHERE (stateid='ME' and name='Camden') and (wkb_geometry
&& setSRID( 'BOX3D(-125 23,-66
50.5)'::BOX3D,find_srid('','incorpbound','wkb_geometry') ))

this would imply mapserver is correctly parsing my query - AND - if i try
to execute this query against postgresql, it does return results - i get
all excited by this.

2 - since query parsing is not left to mapserver (we have to provide the
exact syntax) - there is no reason MS couldnt handle multiple field
criteria.

3 - i see no performance issues or other technical hurdles that would
prevent the execution by MS of this request - unless actually it is tied
to how this information gets back into the TEMPLATE object or is used by
LABELs - both issues i am unclear on (like why a TEMPLATE is /required/ by
MS for queries)

4 - I understood the MS_SINGLE vs MULTIPLE - though i still need to learn
how best to work with this (one problem i have is that a city's boundaries
may come in more than 1 record - but i really just want 1 result -
something i have to tinker with on my end) - thanks for the explanation.


I look forward to reading more on documentation and if i can help, please
let me know.  I am working on a prototype public participation web
application and i need a feature like this to work, and work quickly
(application performance, not how quickly i need 4.4 released).  The two
fields are indexed and i really can't imagine that saving a query and
reloading it is going to be efficient, but i look forward to possibly
hearing from Adam.  As an alternative, i could query on the most
restrictive field and then iterate over the results until i find the value
of the less restrictive field - though ugly, i guess that is an
alternative.

As I have said, i am really impressed with the work that has gone into MS
- and this is a much more involved user community than it was 3 years ago
- great to see.

Thank you again,

Cord

>
> Thomas,
>
> The query mode argument (MS_MULTIPLE) refers to how many *results* you
> want, not how many attributes.  You can only query by one attribute
> at a time, the method should have been named "queryByAttribute" singular
> not plural.  I don't know the history of the name.
>
> Adam Ryan has this trick he uses to AND attribute queries.  It involves
> making a query, then saving it to a file with 'saveQuery', making a new
> query and then adding the results from the saved query using
> queryByIndex.
>
> Maybe he'll see this thread and explain.
>
> Thanks for trying out the 4.4 beta.  What do you think so far?  Are the
> mapscript docs under mapscript/doc helpful?  In the final 4.4.0 release
> there will be three HOWTOs: imagery, querying, and mapfile.
>
> cheers,
> Sean
>



More information about the mapserver-users mailing list