using LoadQuery( ) via MapScript

Ryan, Adam ARyan at CO.LINN.OR.US
Thu May 19 07:43:38 PDT 2005


Adam Ryan
GIS Analyst
Linn County GIS Department
County Courthouse / Room 25
300 SW Fourth Ave.
Albany, OR 97321
541.812.8760
aryan at co.linn.or.us



> -----Original Message-----
> From: Rhys Ickeringill [mailto:rhysi at OMNILINK.COM.AU]
> Sent: Wednesday, May 18, 2005 10:20 PM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: [UMN_MAPSERVER-USERS] using LoadQuery( ) via MapScript
>
>
> Hello again list
>
> Quick question: how can I make use of LoadQuery( )? What does
> it do? The only examples I can find are all of the form:
>
> map.loadQuery( filename )
> map.drawQuery( )
>
> Is this all you can do with loadQuery( )? Can I access
> information such as what layer(s) the query related to? Can I
> somehow get it populate the ResultCacheMember object of the
> layer(s) in which the (saved) query results were located?
>
> Thanks
>
> - Rhys
>

Rhys,

Don't forget saveQuery!  With mapObj.saveQuery(<someRandomFileName>) you can
save a small qry file to disk which is basically a list of record numbers
associated with all the current resultCacheObjs.  In another session you can
reload that query 'state' into your map by using
mapObj.loadQuery(<thatsameRandomFileName>).  You would have to pass the
filename to the user and get it back, obviously, for this to work.  What I
do is generate a random number, say foo, and generate a file called
"temp/qf" + str(foo) + ".qry", but only send foo.  Keep in mind that save
and load work on the mapObj level, so it will save (and load) the cache for
all layers that have one.  Also, it uses the layer index value, so the
layers and the order of the layers in the map needs to be the same between
the load and save.

DrawQuery is only related to the others in that you can only visialize your
query stat by calling a drawQuery() as opposed to draw().

Hope it helps,

Adam



More information about the MapServer-users mailing list