[pmapper-users] Refresh map
Brought to you by:
arminburger
From: Chris B. <be...@wi...> - 2006-12-05 15:49:29
|
I have created a new tool. After running this tool, I want to refresh (reload) the map automatically just like pressing the "Refresh Map" button. Which code do I have to use in the code below to refresh the map. Thanks, Chris Beaart. <?php require_once ("C:/ms4w/Apache/php/PEAR/DB.php"); session_start(); require_once("common.php"); function DB_addPoint($imgxy, $soort, $waarneming, $datum) { $db_host = "localhost"; $db_type = "mysql"; $db_name = "dop"; $db_user = "root"; $db_pwd = "password"; $dsn = "$db_type://$db_user:$db_pwd@$db_host/$db_name"; #error_log ($dsn); #mysql://root:trashcan@localhost/dop // CONVERT PIXEL X/Y TO MAP UNITS $imgxy_arr = explode(" ", $imgxy); $x_pix = $imgxy_arr[0]; $y_pix = $imgxy_arr[1]; $GEOEXT = $_SESSION["GEOEXT"]; $geoDeltaX = $GEOEXT["maxx"] - $GEOEXT["minx"]; $geoDeltaY = $GEOEXT["maxy"] - $GEOEXT["miny"]; $mapW = $_SESSION["mapwidth"]; $mapH = $_SESSION["mapheight"]; $x_geo = round($GEOEXT["minx"] + (($x_pix/$mapW)*$geoDeltaX)); $y_geo = round($GEOEXT["maxy"] - (($y_pix/$mapH)*$geoDeltaY)); // CONNECT TO DB AND RUN QUERY //$geometry = "GeomFromText('POINT($x_geo $y_geo)',26591)"; $sql = "INSERT INTO waarnemingen(x,y,soort,waarneming,datum) VALUES($x_geo,$y_geo,'$soort','$waarneming','$datum')"; #error_log ($sql); $dbh = dbConnect($dsn); $result = $dbh->query($sql); #Closing the current form ?> <script language=JavaScript> window.close(); </script> <? #CODE TO REFRESH MAP if (DB::isError($result)) { error_log($result->getDebugInfo()); } // Check that $result is not an error if (DB::isError($result)) { $dbh->disconnect(); return ($result->getMessage()); } else { $dbh->disconnect(); return 1; } } function dbConnect($dsn) { $dbh = DB::connect($dsn); if (DB::isError($dbh)) { error_log($dbh->getDebugInfo()); } if (DB::isError($dbh)) { die ($dbh->getMessage()); return NULL; } else { return $dbh; } } ?> |