dBox with mode=itemquery or itemnquery

Steve Lime Steve.Lime at DNR.STATE.MN.US
Mon Jul 17 13:18:06 EDT 2006


Rich: This is where AJAX can really help. The dbox code really doesn't help you here. It gives you the
tools to do something with the query result but not with the query itself. 

So, to do this you need 2 things or so:

  1) a method that is called to trigger the search (e.g. myLookup), and process the response
  2) a query template(s) to package the results for use in the client

One might look like:

function myLookup(map, layer, item, term) 
{
    var URL = map.mapserver + '?map=' + map.mapfile + '&mode=itemquery&qlayer=' + layer + '&qitem=' + item + '&qstring=' + term;
    var response = get_content(URL);

    // parse the response somehow, check for errors and such... (in this case the response is just a delimeted line, see template)
    var tokens = response.split(',');

   map.setExtent(tokens[1], tokens[2], tokens[3], tokens[4]);
   map.draw();
}

Two might look like (simple delimited response):

[NAME],[shpminx],[shpminy],[shpmaxx],[shpmaxy]

Does this sort of make sense? You could respond with XML and use that to drive some interface stuff- your choice. I suppose one could write a dbox add-on to turn myLookup into a more formal feature of the software with a callback and all.

Steve

>>> Richard Greenwood <richard.greenwood at GMAIL.COM> 7/17/2006 10:05:27 AM >>>
I am working with Steve's dBox and mapserv.js. It's great stuff. Does
anyone have any examples or suggestions for using mode=itemquery or
itemnquery? Specifically, how are you getting the new extent from the
server into the javascript map object? And how are you updating the
main map image (in mode=map you get an image back, but in
mode=anything_else you get an image in a directory on the server).

Rich

-- 
Richard Greenwood
richard.greenwood at gmail.com 
www.greenwoodmap.com



More information about the mapserver-users mailing list