question on query
Manfred Meier
m.meier at SPIEKERMANN.DE
Thu Aug 10 21:24:33 PDT 2006
Hi Albert,
about the query: your three input fields are named "SCT", "T" and "R".
They sit in a form named "the_map" (if you used this name). The GO
button is no submit button. It does not submit the form, it calls the
javascript function "SetSec()" if you clicking it.
This function gets the values of the three input fields and stores them
in three variables "s", "t" and "r". Then it redirects the browser by
setting ...location.href property to a new constructed url.
As you can see in Lawrence's original code, this url contains the
query-string for the mapserver like "[TWP]="+t where the value of "t" is
filled in. Sorry if this is trivial: the names in [] must match the
fieldnames in your data-source (perhaps dbf-file).
Yesterday I had a problem in my example to construct this query. Dave
Fawcett wrote on my mail the following example:
http ... &qstring=([ZELNR]=1405)
I had some '-characters around it like qstring=('[ZELNR]'='1405')
and got not the correct result. So you have to experiment a bit I think.
If you are unsure if your url is built correct you can do the following:
(from Lawrence's code)
function SetSec(){
var s = document.the_map.SEC.value;
var t = document.the_map.T.value;
var r = document.the_map.R.value;
//Store the new URL into a vraiable and show it before sending it
var u =
"/JasperMaps/cgi-bin/mapserv.exe?&program=%2FJasperMaps%2Fcgi-bin%2Fmapserv.exe&map=C%3A%5CInetPub%5Cwwwroot%5CMapdocs%5CLandCorner.map&zoomsize=2&layers=ortho+Monuments+LandCorners+Water+Shields+Highways+Roads+County+Sections+Quarter+Towns+Township&mode=itemquery&mapext=shapes&slayer=Sections&imgxy=320+240&imgext=1680507.39+547052.00+1844030.00+680312.51&mapshape=&imgshape=&imgbox=&qstring=('[SECTION_]'='"
alert (u); // show it in a message box
window.parent.location.href = u;
}
Manfred
Albert Anderson schrieb:
> Hi Manfred,
>
> Thanks. I got my panning working. Thanks for explaining it. I think I
> understand it now that they all have to be one name. Thanks for your
> help. I am still working on the query.
>
> Thanks,
> Albert
>
> Manfred Meier <m.meier at spiekermann.de> wrote:
>
> Hi Albert,
>
> I copied your html code to my local server and use it for the template
> in the mapfile.
>
> The result is: the Map Tools, Map Layers, Reference Map, legend titles
> appear. The icons for the radio buttons do not appear but that's no
> problem.
>
> The map appears (with some data of mine). If I click on one of the map
> tools, and then into the map, then their is the correct effect. The map
> zooms in or out or recenters.
>
> When I click on the corners of the map margin (for pan), then I get a
> javascript error because "document.mapserv" is undefined.
>
> When I click on the GO button (which took a time to find it) I get
> another javascript error, because "document.corner" is undefined. In
> Lawrence's source code you see that "Corner" is the name of a form.
> Your go-Button is in the form "the_form".
>
> Then I have changed "the_form" to "the_map" and i have changed
> "mapserv"
> in "document.mapserv" to "the_map". Then i deleted the line
> "document.the_map.mode[0].checked=true" because this has an error
> anywhere.
>
> Now the pan functions on the corner of the image are working. Not
> perfect but they do. They pan an zoom. But I think this a not a big
> problem to solve.
>
> I have changed the "document.corner" into document.the_map. So now the
> Go button kind of works. It produces a fresh page.
>
> And I have changed the [program] placeholders to my actual url
> because I
> don't know where to set this value.
>
> Try to do the changes and test every step.
>
> I'm now out. Perhaps til tomorrow.
>
> Manfred
>
>
>
>
>
>
>
>
>
>
>
>
> Albert Anderson schrieb:
>
> > Hi Manfred Meier,
> >
> > I dont know about the errors cause I do not for sure how to open the
> > html code direct in the browser. I have javascript for panning
> arrows
> > around the image that I couldnt get working.
> >
> > For the go button to I have to set some sort of vaule to that? I
> dont kow.
> >
> > Thanks,
> > Albert
> >
> > Manfred Meier wrote:
> >
> > Hi Albert,
> >
> > when I load the html code into the browser then I get javascript
> errors
> > (status line of internet explorer) because document.the_map and
> > document.mapserv are undefined. "document.the_map" is used in the
> > javascript function set_Mode which is called in the onload event.
> > Do you get these errors too?
> >
> > Maybe they come only here because I opened the html code direct
> in the
> > browser.
> >
> > Manfred
> >
> >
> > Albert Anderson schrieb:
> >
> > > Hi Lawrence,
> > >
> > > I tried copying your code and changing out your information to fit
> > > mine. Its not working to well. My button isnt doing anything.
> > Here is
> > > my html code. Maybe you can look at it? I dont know what I am
> doing.
> > > Thanks, Albert
> > >
> > > .....
> >
> >
> >
> >
> ------------------------------------------------------------------------
> > Yahoo! Messenger with Voice. Make PC-to-Phone Calls
> >
> > to the US (and 30+ countries) for 2�/min or less.
>
>
> ------------------------------------------------------------------------
> How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call
> rates.
> <http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
More information about the MapServer-users
mailing list