[mapserver-users] AW: new window query with mapserver

Maul, Andreas-Alexander Andreas.Maul at bgr.de
Mon Dec 3 08:56:30 EST 2001


Dave,
after replacing some german sentences with english phrases, I attach here
some code snippets. I hope the problem will be more clear with it.
Regards,
Andreas

1) map file snippet

MAP
...
# part of the layer section in my map file
#
LAYER
  NAME "Bohrungen"  # wells
  DATA bohrung
  TYPE POINT
  STATUS OFF
  TOLERANCE 7
  TOLERANCEUNITS PIXELS
  SYMBOLSCALE 3000000
  PROJECTION
   "proj=latlong"
   "ellps=bessel"
  END 
  CLASS
    NAME "Bohrungen"
    COLOR 255 204 0 # yellow
    SYMBOL 1
    MINSIZE 3
    MAXSIZE 6 
    TEMPLATE "tbohrung.html"
   END
END   # layer Bohrungen
#
...
END # MAP

2) Content of the template file "tbohrung.html" (the window.open command
doesn't work if I comment out the refresh command. The refresh command alone
does its job; but only in the same window.):

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="0;url=/gga_tif/bohrung.php?mpid=[ID]">
<title>Redirection</title>
<script language="JavaScript">
<!--
window.open("/gga_tif/bohrung.php?mpid=[ID]","width=300,height=300,left=0,to
p=0");
self.focus();// -->
</script>
</head>
<body>
You will be redirected to another address. If your browser doesn't support
redirection please follow
<a href="/gga_tif/bohrung.php?mpid=[ID]">this link</a>.
</body>
</hmtl>

3) First lines of the database query in file "bohrung.html":

</head>
<body>
<h1>Wells Query Result:</h1>
<?php
//----------------------------------------------------------
// database query
//----------------------------------------------------------

$hostname="sql01";
$database="fis_gp";
$username="...";
$password="...";
$querystr="select ID,CODE,BEZEICHNUNG,GEOGR_LAENGE,GEOGR_BREITE,HOEHE_NN
from BOHRUNG where ID=" . $mpid;

$con=mssql_connect($hostname,$username,$password) or die("no connection to
$hostname");
mssql_select_db($database, $con) or die("no connection to database
$database");
$result=mssql_query($querystr, $con);
$thisrow=mssql_fetch_array($result);
$id   = (int) $thisrow["ID"];
$code = $thisrow["CODE"];
$bez  = $thisrow["BEZEICHNUNG"];
$lon   = $thisrow["GEOGR_LAENGE"];
$lat   = $thisrow["GEOGR_BREITE"];
$hoehe = $thisrow["HOEHE_NN"];
mssql_close();
...
(display of query results)
?>
</body>
</html>

-----Ursprüngliche Nachricht-----
Von: David Armstrong [mailto:david.armstrong at ntlworld.com]
Gesendet am: Montag, 3. Dezember 2001 13:58
An: Andreas.Maul at bgr.de
Betreff: new window query with mapserver

Andreas,

can you send me the code you are working with etc
php & javascript and i can have a look and see what can be done. i have been
looking for the same idea too

Regards
Dave



More information about the mapserver-users mailing list