[Manifold-l] Removing WKT parameter from the query pane
Christopher Dronzek
CDRONZEK at flemingc.on.ca
Fri Nov 24 12:54:23 CST 2006
Hello all.
I have been working on an IMS that allows a user to select specific objects with a selection box tool and with that selection the user can execute different queries. In order to do this I had to create my queries using a WKT parameter but by using the WKT parameter the user would have to input a lengthy series of coordinate values. To overcome this I have set up my default.asp file to automatically input those values for the user. I included a “Response.Write(queryPars);” to check the values for the parameters and they seem to be fine.
else if (command == "query") {
if (query == 0){ // TO INPUT WKT PARAMETERS AUTOMATICLY SO THE USER DOESN’T HAVE TO
var wkt = Session("wkt");
queryPars = wkt + queryPars; // TWO PARAMETERS
//Response.Write(queryPars); TO CHECK THE VARIABLE
tableSrc = "table.asp?command=" + Server.URLEncode(command) + "&query=" + Server.URLEncode(query) + "&queryPars=" + Server.URLEncode(queryPars);
}
if (query == 1) {
var wkt = Session("wkt");
queryPars = wkt;
//Response.Write(queryPars);
tableSrc = "table.asp?command=" + Server.URLEncode(command) + "&query=" + Server.URLEncode(query) + "&queryPars=" + Server.URLEncode(queryPars);
}
mapserver.Query(query, queryPars);
tableSrc = "table.asp?command=" + Server.URLEncode(command) + "&query=" + Server.URLEncode(query) + "&queryPars=" + Server.URLEncode(queryPars);
mapserver.Query(parseInt(query),queryPars); // THIS IS TO FIX VIEWING BUG AFTER A QUERY IS MADE
}
At this point everything works great but in the queries pane the WKT input field is still displayed and I want to hide it because it is not necessary to fill it out. For this issue I added to the // create results code, a section that will remove the first parameter (WKT) in each query. The code removes the WKT field in the query pane and the queries run fine that have a single parameter except for a query that uses 2 input fields, one for WKT and another for a buffer radius. When it is run I always get a “No records found” message even though I should. Of course now I’m not sure where I’m going wrong. Am I taking the right approach or is there better way to remove a parameter from the query pane without interfering with the query itself?
Again any assistance would be much appreciated.
Thanks.
Todd.
I’m using v6.5, with JScript and ASP.
Here is the code:
for (queryItem in queryList) {
if (queryList[queryItem] != "") {
queriesC = queriesC + "<tr><td><table><tr><td>" + encode(queryList[queryItem]) + "</td></tr>\n";
var queryPar = mapserver.QueryParameters(querySqno);
var parList = queryPar.split("\n");
var parItem;
var parNumber = 0;
for (parItem in parList) {
if (parItem == "0"){ // TO REMOVE THE WKT FIELD FROM THE QUERY PANE
if (parList[parItem] != "")
queriesC = queriesC + "<tr><td>" + encode(parList[parItem]) + "</td></tr><tr><td><input type=\"edit\" id=\"q" + querySqno + "p" + parNumber + "\" name=\"q" + querySqno + "p" + parNumber + "\" size=\"10\"></td></tr>\n";
}
parNumber++;
}
queriesC = queriesC + "<tr><td><input type=\"button\" class=\"panetext\" value=\"Query\" onclick=\"execQuery('"+ querySqno + "');\"></td></tr></table><center>_________________________</center></td></tr>\n"
}
querySqno++;
}
More information about the Manifold-l
mailing list