[Mapbender-commits] r5316 - branches/2.6/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Jan 13 06:08:13 EST 2010
Author: christoph
Date: 2010-01-13 06:08:13 -0500 (Wed, 13 Jan 2010)
New Revision: 5316
Modified:
branches/2.6/http/php/mod_changeEPSG_server.php
Log:
Modified: branches/2.6/http/php/mod_changeEPSG_server.php
===================================================================
--- branches/2.6/http/php/mod_changeEPSG_server.php 2010-01-13 11:07:06 UTC (rev 5315)
+++ branches/2.6/http/php/mod_changeEPSG_server.php 2010-01-13 11:08:13 UTC (rev 5316)
@@ -21,7 +21,7 @@
$epsgObj = array();
-$ajaxResponse = new AjaxResponse($_REQUEST);
+$ajaxResponse = new AjaxResponse($_POST);
switch ($ajaxResponse->getMethod()) {
case "changeEpsg" :
@@ -46,38 +46,38 @@
$con = db_connect($DBSERVER,$OWNER,$PW);
$sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".$extArray[0]." ".$extArray[1].")',".$oldEPSG."),".$newEPSG.")) as minx";
$resMinx = db_query($sqlMinx);
- $minx = db_result($resMinx,0,"minx");
+ $minx = floatval(db_result($resMinx,0,"minx"));
$sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(".$extArray[0]." ".$extArray[1].")',".$oldEPSG."),".$newEPSG.")) as miny";
$resMiny = db_query($sqlMiny);
- $miny = db_result($resMiny,0,"miny");
+ $miny = floatval(db_result($resMiny,0,"miny"));
$sqlMaxx = "SELECT X(transform(GeometryFromText('POINT(".$extArray[2]." ".$extArray[3].")',".$oldEPSG."),".$newEPSG.")) as maxx";
$resMaxx = db_query($sqlMaxx);
- $maxx = db_result($resMaxx,0,"maxx");
+ $maxx = floatval(db_result($resMaxx,0,"maxx"));
$sqlMaxy = "SELECT Y(transform(GeometryFromText('POINT(".$extArray[2]." ".$extArray[3].")',".$oldEPSG."),".$newEPSG.")) as maxy";
$resMaxy = db_query($sqlMaxy);
- $maxy = db_result($resMaxy,0,"maxy");
+ $maxy = floatval(db_result($resMaxy,0,"maxy"));
}else{
$con_string = "host=$GEOS_DBSERVER port=$GEOS_PORT dbname=$GEOS_DB user=$GEOS_OWNER password=$GEOS_PW";
$con = pg_connect($con_string) or die ("Error while connecting database");
$sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".$extArray[0]." ".$extArray[1].")',".$oldEPSG."),".$newEPSG.")) as minx";
$resMinx = pg_query($con,$sqlMinx);
- $minx = pg_fetch_result($resMinx,0,"minx");
+ $minx = floatval(pg_fetch_result($resMinx,0,"minx"));
$sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(".$extArray[0]." ".$extArray[1].")',".$oldEPSG."),".$newEPSG.")) as miny";
$resMiny = pg_query($con,$sqlMiny);
- $miny = pg_fetch_result($resMiny,0,"miny");
+ $miny = floatval(pg_fetch_result($resMiny,0,"miny"));
$sqlMaxx = "SELECT X(transform(GeometryFromText('POINT(".$extArray[2]." ".$extArray[3].")',".$oldEPSG."),".$newEPSG.")) as maxx";
$resMaxx = pg_query($con,$sqlMaxx);
- $maxx = pg_fetch_result($resMaxx,0,"maxx");
+ $maxx = floatval(pg_fetch_result($resMaxx,0,"maxx"));
$sqlMaxy = "SELECT Y(transform(GeometryFromText('POINT(".$extArray[2]." ".$extArray[3].")',".$oldEPSG."),".$newEPSG.")) as maxy";
$resMaxy = pg_query($con,$sqlMaxy);
- $maxy = pg_fetch_result($resMaxy,0,"maxy");
+ $maxy = floatval(pg_fetch_result($resMaxy,0,"maxy"));
}
$extenty = $maxy - $miny;
$extentx = $maxx - $minx;
@@ -95,14 +95,27 @@
$miny = $centery - $relation_px_y * $extentx / 2;
$maxy = $centery + $relation_px_y * $extentx / 2;
}
- $epsgObj[$i] = array(
- "frameName" => $currentEpsg->frameName,
- "newSrs" => $newSrs,
- "minx" => $minx,
- "miny" => $miny,
- "maxx" => $maxx,
- "maxy" => $maxy
- );
+
+ if ($currentEpsg->frameName) {
+ $epsgObj[$i] = array(
+ "frameName" => $currentEpsg->frameName,
+ "newSrs" => $newSrs,
+ "minx" => $minx,
+ "miny" => $miny,
+ "maxx" => $maxx,
+ "maxy" => $maxy
+ );
+ }
+ else {
+ $epsgObj[$i] = array(
+ "wms" => $currentEpsg->wms,
+ "newSrs" => $newSrs,
+ "minx" => $minx,
+ "miny" => $miny,
+ "maxx" => $maxx,
+ "maxy" => $maxy
+ );
+ }
}
else {
$ajaxResponse->setSuccess(false);
@@ -120,4 +133,4 @@
}
$ajaxResponse->send();
-?>
\ No newline at end of file
+?>
More information about the Mapbender_commits
mailing list