question on query

Albert Anderson bart_doggers at YAHOO.COM
Fri Aug 11 11:58:22 EDT 2006


Hi Manfred,
 
I got the query working using query templates. But I want to image of the parcel to load in the image map.  How would I go that?  I bet I need another table by the parcel fields.  And have the information load into that table.  Then have a link PIN link go to the image in the image map. Here is my code your the html, query templates. Could you help me.

Albert

header query code
<br />
<font size+1><b>Layer: Parcels</b></font>

<table border=1>
<tr>
<th>shpidx</th>
<th>Pin No.</th>
<th>Section</th>
<th>Township</th>
<th>Range</th>
</tr>



parcels query code
<tr>
    <td>[shpidx]</td>
    <td>
<a href="http://[host]/cgi-bin/mapserv?
mode=indexquerymap&
qlayer=parcels&
shapeindex=[shpidx]&
shpext=[shpext_esc]&
mapext=shape&
map=[map]">
    [PIN]
    </a></td>
    <td>[SCT]</td>
    <td>[TWP]</td>
    <td>[RNG]</td>
</tr>

html code
<SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
  function SetSec(){
    var s = document.the_map.SCT.value;
    var t = document.the_map.T.value;
    var r = document.the_map.R.value;

window.parent.location.href = "http://10.56.67.192/cgi-bin/mapserv?map=/home/mapdata/richland.map&mode=itemquery&mapext=shapes&slayer=parcels&imgxy=309 419&imgext=625173.309834 5085113.091715 718065.960556 5160035.212592&mapshape=&imgshape=&imgbox=&qstring=('[SCT]'='" + s + "' AND '[TWP]'='" + t + "' AND '[RNG]'='" + r + "')&qlayer=parcels&qitem=&shapeindex=&savequery=";  
}
</SCRIPT>

Manfred Meier <m.meier at SPIEKERMANN.DE> wrote: 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  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. 
> 


 		
---------------------------------
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.
 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060811/4ca383eb/attachment.html


More information about the mapserver-users mailing list