[mapserver-users] oraclespatial query through CGI

Rodrigo Cabral cabral at yadata.net
Fri Apr 19 09:22:16 EDT 2002


Hey there:

What you need to do is to send the query to your querymap.pl, instead of
sending it to mapserver's CGI. My HTML coding is quite different from yours.
Go to http://g10.cttmar.univali.br/rastro/, click in "versão de
demonstração", and you'll see what I mean.

Anyway, I'll try to give you some hints on how you can proceed from the code
you have now.

1) You will have to change the action in your form accordingly, using
javascript. If the user selects "query" for "mode", then your action is
"/cgi-bin/querymap.pl"; likewise, when "mode" is "browse" action is set to
"/cgi-bin/mapserver/mapserv". You may use the onclick event in both of your
"mode" radio button tags.

2) You will have to change querymap.pl to work with the physical (image),
not logical (map) coordinates. This means that you remove DoQuery from your
HTML, and put its "idea" in perl. In your case you won't have a rectangle to
query, but a point (img.x and img.y must be used for qx1 and qy1), and
imgext is the variable which's holding your extent values for translating
physical to logical units. nx and ny are constants based on the size in
pixels of your image.

I'd love to give code samples, but kinda in a hurry right now...

Cheers,
Rod.

----- Original Message -----
From: "Yu-Hsin Chen" <ychen at yorktel.com>
To: <mapserver-users at lists.gis.umn.edu>
Sent: Thursday, April 18, 2002 2:18 PM
Subject: [mapserver-users] oraclespatial query through CGI


I'm running the mapserver 3.5 CGI version and HTML template on a Linux
system.

I followed Rod's guidance of Feb 11 and put a javascript function called
DoQuery in my HTML file to call a Perl program (Rod's original version calls
a PHP program, I figured it should work with Perl).

Now my question is how do I specify when this DoQuery function is called.
I'm still getting the error message of function not implemented when I
execute the new HTML.

Yu-Hsin Chen

<html>
<head><title>GIS Capabilities</title>
<script language="javascript">
function DoQuery( url_query, x1, y1, x2, y2 )
{
  size = imgsize.split( /\+/ );
  ext = imgext.split( /\+/ );

  nx = eval( size[0] ) - 1;
  ny = eval( size[1] ) - 1;

  minx = eval( ext[0] );
  miny = eval( ext[1] );
  maxx = eval( ext[2] );
  maxy = eval( ext[3] );

  qx1 = x1*(maxx - minx)/nx + minx;
  qx2 = x2*(maxx - minx)/nx + minx;

  qy1 = (ny - y1)*(maxy - miny)/ny + miny;
  qy2 = (ny - y2)*(maxy - miny)/ny + miny;

  document.location = 'http://localhost/cgi-bin/querymap.pl?qx1=' + qx1 +
'&qy1=' + qy1 + '&qx2=' + qx2 + '&qy2=' + qy2;
}
</script>
</head>
<body bgcolor=#FFFFFF>

<center><h1>SSA IVT 289 Site Cut-Over Status</h1></center>
<hr>
<form method=GET action="/cgi-bin/mapserver/mapserv">

<center>
<table border=0 cellspacing=0 cellpadding=4 bgcolor="#000000">
<tr>
<td valign="top" align=center>
  <table cellpadding="0" cellspacing="0" border="0">
    <tr><td colspan="2"><INPUT NAME="img" TYPE="image" SRC="[img]" width=600
height=400 border=0></td></tr>
    <tr>
      <td>&nbsp;<font size=-1 face="arial,helvetica"
color="#FFFFFF"><b>Powered by MapServer</b></font></td>
    </tr>
  </table>
</td>
<td valign="top" bgcolor=#ffffff>
  <table cellpadding="5" cellspacing="0" border="0" bgcolor="#ffffff">
    <tr><td>
    <center><input type="submit" value="Refresh Map"></center>
      <p>


      <input type="radio" name="mode" value="browse" checked> <b>Refresh
Map</b><br>
      <input type="radio" name="mode" value="query"> <b>Query Data</b><br>


      <hr>

      <p>
      <input type=radio name=zoomdir value=1 [zoomdir_1_check]> Zoom In<br>
      <input type=radio name=zoomdir value=0 [zoomdir_0_check]> Pan <br>
      <input type=radio name=zoomdir value=-1 [zoomdir_-1_check]> Zoom
Out<br>
      <p>
      Zoom Size <input type=text name=zoomsize size=4 value=[zoomsize]>
      <p>
      <font size=+1><b>Legend</b></font><br><hr>
      <img src="[legend]"><hr>


    </td></tr></table>

  </td></tr>
</table>
</center>

<input type="hidden" name="imgxy" value="299.5 299.5">
<input type="hidden" name="imgext" value="[mapext]">
<input type="hidden" name="url_query"
value="http://localhost/cgi-bin/querymap.pl">
<input type="hidden" name="map" value="/web/dvp/mapserver/ssa/usa.map">
<input type="hidden" name="savequery" value="true">

<input type="hidden" name="program" value="/cgi-bin/mapserver/mapserv">
<input type="hidden" name="map_web_imagepath" value="/web/dvp/tmp/">
<input type="hidden" name="map_web_imageurl" value="/tmp/">

</form>

<p><hr><p>

</body></html>






More information about the mapserver-users mailing list