[Mapbender-commits] r9409 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Feb 23 07:27:34 PST 2016
Author: armin11
Date: 2016-02-23 07:27:34 -0800 (Tue, 23 Feb 2016)
New Revision: 9409
Modified:
trunk/mapbender/http/classes/class_point.php
trunk/mapbender/http/classes/class_wfs_1_0_factory.php
Log:
Possibility to allow INSPIRE ATOM Feeds with simple wfs 1.0 (qgis cloud), bugfix for parsing latlon bbox of wfs 1.0 featuretypes (they don't need to be given in latlon :-( )
Modified: trunk/mapbender/http/classes/class_point.php
===================================================================
--- trunk/mapbender/http/classes/class_point.php 2016-02-23 11:31:44 UTC (rev 9408)
+++ trunk/mapbender/http/classes/class_point.php 2016-02-23 15:27:34 UTC (rev 9409)
@@ -166,38 +166,45 @@
//get EPSG:4326 extents for which $this->epsg are defined
$geometryUnchanged = true;
if (defined("SRS_ARRAY") && SRS_ARRAY !== "" ) {
- //check if this->epsg is 4326
- $posTargetEpsgBbox = array_search($targetEpsg,explode(",",SRS_ARRAY));
- if ($posTargetEpsgBbox !== false) {
- //check if bboxes are defined for special epsg SRS_ARRAY_MAX_EXTENTS
- if (defined("SRS_ARRAY_MAX_EXTENTS") && SRS_ARRAY_MAX_EXTENTS !== "" ) {
- $bboxArray = explode("|",SRS_ARRAY_MAX_EXTENTS);
- $wgs84BboxTargetEpsg = explode(",",$bboxArray[$posTargetEpsgBbox]);
- //compare point values with bboxes and adopt them if needed
- //$e = new mb_exception("class_point: bbox compare started before transforming!!!");
- //$e = new mb_exception("class_point: minx:".$wgs84BboxTargetEpsg[0]." - miny:".$wgs84BboxTargetEpsg[1]." - maxx:".$wgs84BboxTargetEpsg[2]." - maxy:".$wgs84BboxTargetEpsg[3]);
- if ($this->x < $wgs84BboxTargetEpsg[0]) {
- $this->x = $wgs84BboxTargetEpsg[0];
- $geometryUnchanged = false;
- }
- if ($this->x > $wgs84BboxTargetEpsg[2]) {
- $this->x = $wgs84BboxTargetEpsg[2];
- $geometryUnchanged = false;
- }
- if ($this->y < $wgs84BboxTargetEpsg[1]) {
- $this->y = $wgs84BboxTargetEpsg[1];
- $geometryUnchanged = false;
- }
- if ($this->y > $wgs84BboxTargetEpsg[3]) {
- $this->y = $wgs84BboxTargetEpsg[3];
- $geometryUnchanged = false;
- }
+ //check if this->epsg is 4326 - if
+ if ($toEpsg == "4326") {
+ //do nothing - every crs can be projected to latlon without any problems!
+ } else {
+ $posTargetEpsgBbox = array_search($targetEpsg,explode(",",SRS_ARRAY));
+ if ($posTargetEpsgBbox !== false) {
+ //check if bboxes are defined for special epsg SRS_ARRAY_MAX_EXTENTS
+ if (defined("SRS_ARRAY_MAX_EXTENTS") && SRS_ARRAY_MAX_EXTENTS !== "" ) {
+ $bboxArray = explode("|",SRS_ARRAY_MAX_EXTENTS);
+ $wgs84BboxTargetEpsg = explode(",",$bboxArray[$posTargetEpsgBbox]);
+ //compare point values with bboxes and adopt them if needed
+ //$e = new mb_exception("class_point: bbox compare started before transforming!!!");
+ //$e = new mb_exception("class_point: minx:".$wgs84BboxTargetEpsg[0]." - miny:".$wgs84BboxTargetEpsg[1]." - maxx:".$wgs84BboxTargetEpsg[2]." - maxy:".$wgs84BboxTargetEpsg[3]);
+ if ($this->x < $wgs84BboxTargetEpsg[0]) {
+ $this->x = $wgs84BboxTargetEpsg[0];
+ $geometryUnchanged = false;
+ }
+ if ($this->x > $wgs84BboxTargetEpsg[2]) {
+ $this->x = $wgs84BboxTargetEpsg[2];
+ $geometryUnchanged = false;
+ }
+ if ($this->y < $wgs84BboxTargetEpsg[1]) {
+ $this->y = $wgs84BboxTargetEpsg[1];
+ $geometryUnchanged = false;
+ }
+ if ($this->y > $wgs84BboxTargetEpsg[3]) {
+ $this->y = $wgs84BboxTargetEpsg[3];
+ $geometryUnchanged = false;
+ }
+ }
}
}
- }
+ }
db_begin();
$sql = "SELECT X(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as x, ";
$sql .= "Y(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as y";
+ if (!$geometryUnchanged) {
+ $e = new mb_exception("geometry changed!!!!!!");
+ }
if (isset($this->z)) {
$sql .= ", Z(transform(GeometryFromText('POINT(".$this->x." ".$this->y." ".$this->z.")',".$currentEpsg."),".$targetEpsg.")) as z";
}
Modified: trunk/mapbender/http/classes/class_wfs_1_0_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_0_factory.php 2016-02-23 11:31:44 UTC (rev 9408)
+++ trunk/mapbender/http/classes/class_wfs_1_0_factory.php 2016-02-23 15:27:34 UTC (rev 9409)
@@ -218,7 +218,23 @@
$featuretype_latlon_maxx = $featuretype_latlon_maxx[0];
$featuretype_latlon_maxy = $LatLongBoundingBox->xpath('@maxy');
$featuretype_latlon_maxy = $featuretype_latlon_maxy[0];
-
+ //NOTICE: for WFS 1.0.0 latlonbbox is given in featuretypes SRS and not in EPSG:4326 - it has to be reprojected ;-)
+ $n = new mb_notice("Calculation of BBOX for EPSG:4326");
+ $pointMin = new Mapbender_point($featuretype_latlon_minx, $featuretype_latlon_miny, preg_replace("/EPSG:/", "", $featuretype_srs));
+ $pointMax = new Mapbender_point($featuretype_latlon_maxx, $featuretype_latlon_maxy, preg_replace("/EPSG:/", "", $featuretype_srs));
+ $pointMin->transform("4326");
+ $pointMax->transform("4326");
+ if($pointMin->epsg != '' && $pointMin->x != '' && $pointMin->y != ''
+ && $pointMax->x != '' && $pointMax->y != '') {
+ $featuretype_latlon_minx = $pointMin->x;
+ $featuretype_latlon_miny = $pointMin->y;
+ $featuretype_latlon_maxx = $pointMax->x;
+ $featuretype_latlon_maxy = $pointMax->y;
+ $n = new mb_notice("Calculation of BBOX for EPSG:4326 finished successful.");
+ }
+ else {
+ $e = new mb_exception("Could not transform BBOX from ".$featuretype_srs." to EPSG:4326.");
+ }
//<wfs:MetadataURL type="FGDC" format="text/xml">http://www.ogccatservice.com/csw.cgi?service=CSW&version=2.0.0&request=GetRecords&constraintlanguage=CQL&constraint="recordid=urn:uuid:4ee8b2d3-9409-4a1d-b26b-6782e4fa3d59"</wfs:MetadataURL>
$metadataURLArray = $featureType->MetadataURL;
$featuretype_metadataUrl = array();
More information about the Mapbender_commits
mailing list