[Mapbender-commits] r2426 - branches/darndt_dev/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue May 6 08:59:26 EDT 2008


Author: darndt
Date: 2008-05-06 08:59:25 -0400 (Tue, 06 May 2008)
New Revision: 2426

Added:
   branches/darndt_dev/http/php/mod_zoomfull_projection.php
Log:


Added: branches/darndt_dev/http/php/mod_zoomfull_projection.php
===================================================================
--- branches/darndt_dev/http/php/mod_zoomfull_projection.php	                        (rev 0)
+++ branches/darndt_dev/http/php/mod_zoomfull_projection.php	2008-05-06 12:59:25 UTC (rev 2426)
@@ -0,0 +1,56 @@
+<?php
+# $Id: mod_wfs.php 2144 2008-02-26 23:16:14Z christoph $
+# http://www.mapbender.org/index.php/Administration
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$epsg = strip_tags($_POST['epsg']);
+$epsg_gui = strip_tags($_POST['epsg_gui']);
+$minx = strip_tags($_POST['minx']);
+$miny = strip_tags($_POST['miny']);
+$maxx = strip_tags($_POST['maxx']);
+$maxy = strip_tags($_POST['maxy']);
+$type = "POINT";
+
+$link = pg_connect("host=" .$DBSERVER. " dbname=".$DB. " user=" .$OWNER);
+$sql_transform = "SELECT astext(transform(GeometryFromText('". $type . "(" .$minx. " " . $miny . ")', $epsg_gui), " . $epsg . "))";
+
+$result_transform = pg_query($link, $sql_transform);
+$result_transform;
+while($row_transform = pg_fetch_array($result_transform)){
+	$coordinates = trim($row_transform['astext']);
+}
+$coordinates = str_replace("POINT(", "'minx':", $coordinates);
+$coordinates = str_replace(")", "", $coordinates);
+$coordinates = str_replace(" ", ", 'miny':", $coordinates);
+$coordinates_temp = "{" .$coordinates. ", ";
+
+$sql_transform = "SELECT astext(transform(GeometryFromText('". $type . "(" .$maxx. " " . $maxy . ")', $epsg_gui), " . $epsg . "))";
+
+$result_transform = pg_query($link, $sql_transform);
+$result_transform;
+while($row_transform = pg_fetch_array($result_transform)){
+	$coordinates = trim($row_transform['astext']);
+}
+$coordinates = str_replace("POINT(", "'maxx':", $coordinates);
+$coordinates = str_replace(")", "", $coordinates);
+$coordinates = str_replace(" ", ", 'maxy':", $coordinates);
+$coordinates =  $coordinates_temp .$coordinates. "}";
+
+echo $coordinates;
+?> 



More information about the Mapbender_commits mailing list