[Mapbender-commits] r9538 - in trunk/mapbender/http: classes php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Jul 13 02:31:53 PDT 2016
Author: pschmidt
Date: 2016-07-13 02:31:52 -0700 (Wed, 13 Jul 2016)
New Revision: 9538
Modified:
trunk/mapbender/http/classes/class_universal_wfs_factory.php
trunk/mapbender/http/classes/class_wfs_2_0_factory.php
trunk/mapbender/http/php/mod_showMetadata.php
trunk/mapbender/http/php/mod_wfs_server.php
Log:
fix wfs parser, add 'properties' to wfs metadata
Modified: trunk/mapbender/http/classes/class_universal_wfs_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_universal_wfs_factory.php 2016-07-13 08:57:57 UTC (rev 9537)
+++ trunk/mapbender/http/classes/class_universal_wfs_factory.php 2016-07-13 09:31:52 UTC (rev 9538)
@@ -74,6 +74,9 @@
case "2.0.0":
$factory = new Wfs_2_0_Factory();
break;
+ case "2.0.2":
+ $factory = new Wfs_2_0_Factory();
+ break;
default:
throw new Exception("Unknown WFS version " . $version);
break;
Modified: trunk/mapbender/http/classes/class_wfs_2_0_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_2_0_factory.php 2016-07-13 08:57:57 UTC (rev 9537)
+++ trunk/mapbender/http/classes/class_wfs_2_0_factory.php 2016-07-13 09:31:52 UTC (rev 9538)
@@ -315,155 +315,129 @@
$myWfs->auth = $auth; //always!
$featuretype_crsArray = array();
try {
- $xml = str_replace('xlink:href', 'xlinkhref', $xml);
+// $xml = str_replace('xlink:href', 'xlinkhref', $xml);
#http://forums.devshed.com/php-development-5/simplexml-namespace-attributes-problem-452278.html
#http://www.leftontheweb.com/message/A_small_SimpleXML_gotcha_with_namespaces
- $wfs20Cap = new SimpleXMLElement($xml);
-
- if ($wfs20Cap === false) {
- foreach(libxml_get_errors() as $error) {
- $e = new mb_exception($error->message);
- }
- throw new Exception('Cannot parse WFS 2.0.0 Capabilities!');
- }
+// $wfs20Cap = new SimpleXMLElement($xml);
+// if ($wfs20Cap === false) {
+// foreach(libxml_get_errors() as $error) {
+// $e = new mb_exception($error->message);
+// }
+// throw new Exception('Cannot parse WFS 2.0.0 Capabilities!');
+// }
+ $wfs20Cap = new DOMDocument();
+ if (!$wfs20Cap->loadXML($xml)) {
+ throw new Exception("Cannot parse WFS 2.0.0 Capabilities!");
+ }
}
catch (Exception $e) {
$e = new mb_exception($e->getMessage());
}
if ($wfs20Cap !== false) {
- //read all relevant information an put them into the mapbender wfs object
- //xmlns="http://www.opengis.net/wfs"
- //Setup default namespace
- $namespaces = $wfs20Cap->getNamespaces(true);
- if(isset($namespaces[""])) { // if you have a default namespace
- // register a prefix for that default namespace:
- $wfs20Cap->registerXPathNamespace("wfs", $namespaces[""]);
- } else {
- $wfs20Cap->registerXPathNamespace("wfs", "http://www.opengis.net/wfs/2.0");
- }
- $wfs20Cap->registerXPathNamespace("ows", "http://www.opengis.net/ows");
- $wfs20Cap->registerXPathNamespace("gml", "http://www.opengis.net/gml");
- $wfs20Cap->registerXPathNamespace("ogc", "http://www.opengis.net/ogc");
- $wfs20Cap->registerXPathNamespace("xlink", "http://www.w3.org/1999/xlink");
- $wfs20Cap->registerXPathNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
- $wfs20Cap->registerXPathNamespace("default", "http://www.opengis.net/wfs");
+// //read all relevant information an put them into the mapbender wfs object
+// //xmlns="http://www.opengis.net/wfs"
+// //Setup default namespace
+// $namespaces = $wfs20Cap->getNamespaces(true);
+// if(isset($namespaces[""])) { // if you have a default namespace
+// // register a prefix for that default namespace:
+// $wfs20Cap->registerXPathNamespace("wfs", $namespaces[""]);
+// } else {
+// $wfs20Cap->registerXPathNamespace("wfs", "http://www.opengis.net/wfs/2.0");
+// }
+// $wfs20Cap->registerXPathNamespace("ows", "http://www.opengis.net/ows");
+// $wfs20Cap->registerXPathNamespace("gml", "http://www.opengis.net/gml");
+// $wfs20Cap->registerXPathNamespace("ogc", "http://www.opengis.net/ogc");
+// $wfs20Cap->registerXPathNamespace("xlink", "http://www.w3.org/1999/xlink");
+// $wfs20Cap->registerXPathNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+// $wfs20Cap->registerXPathNamespace("default", "http://www.opengis.net/wfs");
//some debug
//$e = new mb_notice("XML string from memory: ".$wfs20Cap->asXML());
- $myWfs->version = $wfs20Cap->xpath('/wfs:WFS_Capabilities/@version');
- $myWfs->version = $myWfs->version[0];
- //identification part
- $myWfs->name = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:Name');
- $myWfs->name = $myWfs->name[0];
- $myWfs->title = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:Title');
- $myWfs->title = $this->stripEndlineAndCarriageReturn($myWfs->title[0]);
- $myWfs->summary = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:Abstract');
- $myWfs->summary = $this->stripEndlineAndCarriageReturn($myWfs->summary[0]);
- $myWfs->fees = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:Fees');
- $myWfs->fees = $myWfs->fees[0];
- $myWfs->accessconstraints = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:AccessConstraints');
- $myWfs->accessconstraints = $myWfs->accessconstraints[0];
+
+ $xpath = new \DOMXPath($wfs20Cap);
+ $xpath->registerNamespace("xlink", "http://www.w3.org/1999/xlink");
+ foreach ($xpath->query('namespace::*', $this->doc->documentElement) as $node) {
+ $nsPrefix = $node->prefix;
+ $nsUri = $node->nodeValue;
+ if ($nsPrefix == "" && $nsUri == "http://www.opengis.net/wfs/2.0") {
+ $nsPrefix = "wfs";
+ }
+ $xpath->registerNamespace($nsPrefix, $nsUri);
+ }
+
+ $myWfs->version = $this->getValue($xpath, '/wfs:WFS_Capabilities/@version', $wfs20Cap);
+ $myWfs->name = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:Name/text()', $wfs20Cap);
+ $myWfs->title = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:Title/text()', $wfs20Cap);
+ $myWfs->summary = $this->stripEndlineAndCarriageReturn($this->getValue(
+ $xpath, '/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:Abstract/text()', $wfs20Cap));
+ $myWfs->fees = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:Fees/text()', $wfs20Cap);
+ $myWfs->accessconstraints = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceIdentification/ows:AccessConstraints/text()', $wfs20Cap);
//provider part
- $myWfs->individualName = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:IndividualName');
- $myWfs->individualName = $myWfs->individualName[0];
-
- $myWfs->positionName = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:PositionName');
- $myWfs->positionName = $myWfs->positionName[0];
+ $myWfs->individualName = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:IndividualName/text()', $wfs20Cap);
- $myWfs->providerName = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ProviderName');
- $myWfs->providerName = $myWfs->providerName[0];
-
- $myWfs->city = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:City');
- $myWfs->city =$myWfs->city[0];
+ $myWfs->positionName = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:PositionName/text()', $wfs20Cap);
- $myWfs->deliveryPoint = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:DeliveryPoint');
- $myWfs->deliveryPoint =$myWfs->deliveryPoint[0];
+ $myWfs->providerName = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ProviderName/text()', $wfs20Cap);
- $myWfs->administrativeArea = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:AdministrativeArea');
- $myWfs->administrativeArea =$myWfs->administrativeArea[0];
+ $myWfs->city = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:City/text()', $wfs20Cap);
- $myWfs->postalCode = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:PostalCode');
- $myWfs->postalCode =$myWfs->postalCode[0];
+ $myWfs->deliveryPoint = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:DeliveryPoint/text()', $wfs20Cap);
- $myWfs->country = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:Country');
- $myWfs->country =$myWfs->country[0];
+ $myWfs->administrativeArea = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:AdministrativeArea/text()', $wfs20Cap);
- $myWfs->voice = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Phone/ows:Voice');
- $myWfs->voice =$myWfs->voice[0];
+ $myWfs->postalCode = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:PostalCode/text()', $wfs20Cap);
- $myWfs->facsimile = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Phone/ows:Facsimile');
- $myWfs->facsimile =$myWfs->facsimile[0];
+ $myWfs->country = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:Country/text()', $wfs20Cap);
- $myWfs->electronicMailAddress = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:ElectronicMailAddress');
- $myWfs->electronicMailAddress =$myWfs->electronicMailAddress[0];
+ $myWfs->voice = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Phone/ows:Voice/text()', $wfs20Cap);
+ $myWfs->facsimile = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Phone/ows:Facsimile/text()', $wfs20Cap);
+ $myWfs->electronicMailAddress = $this->getValue($xpath, '/wfs:WFS_Capabilities/ows:ServiceProvider/ows:ServiceContact/ows:ContactInfo/ows:Address/ows:ElectronicMailAddress/text()', $wfs20Cap);
+
//Operation Metadata Part
- $myWfs->getCapabilities = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name="GetCapabilities"]/ows:DCP/ows:HTTP/ows:Get/@xlinkhref');
- $myWfs->getCapabilities = html_entity_decode($myWfs->getCapabilities[0]);
- $e = new mb_notice($myWfs->getCapabilities);#get
+ $myWfs->getCapabilities = html_entity_decode($this->getValue($xpath, '/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name="GetCapabilities"]/ows:DCP/ows:HTTP/ows:Get/@xlink:href', $wfs20Cap));
+
+ $myWfs->describeFeatureType = html_entity_decode($this->getValue($xpath, '/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name="DescribeFeatureType"]/ows:DCP/ows:HTTP/ows:Get/@xlink:href', $wfs20Cap));
- $myWfs->describeFeatureType = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name="DescribeFeatureType"]/ows:DCP/ows:HTTP/ows:Get/@xlinkhref');
- $myWfs->describeFeatureType = html_entity_decode($myWfs->describeFeatureType[0]);#get
-
- $myWfs->getFeature = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name="GetFeature"]/ows:DCP/ows:HTTP/ows:Post/@xlinkhref');
- $myWfs->getFeature = html_entity_decode($myWfs->getFeature[0]);#post
-
- $myWfs->transaction = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name="Transaction"]/ows:DCP/ows:HTTP/ows:Post/@xlinkhref');
- $myWfs->transaction = html_entity_decode($myWfs->transaction[0]);#post
+ $myWfs->getFeature = html_entity_decode($this->getValue($xpath, '/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name="GetFeature"]/ows:DCP/ows:HTTP/ows:Post/@xlink:href', $wfs20Cap));
+ $myWfs->transaction = html_entity_decode($this->getValue($xpath, '/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name="Transaction"]/ows:DCP/ows:HTTP/ows:Post/@xlink:href', $wfs20Cap));
//get list of featuretypes
- $capFeatureTypes = $wfs20Cap->xpath('/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType');
+ $capFeatureTypes = $xpath->query('/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType', $wfs20Cap);
$i = 1; //cause index of xml objects begin with 1
foreach ($capFeatureTypes as $featureType) {
- //debug
- $e = new mb_notice("ft: ".$featureType->asXML());
- //check if the wfs namespaces are used in the featuretype object - as done by e.g. ArcGIS Server
- $wfsNamespaceUsed = false;
- $ftNamespaces = $featureType->getNameSpaces(true);
- foreach ($ftNamespaces as $key => $value) {
- if ($value == 'http://www.opengis.net/wfs') {
- $wfsNamespaceUsed = true;
- }
- }
- if ($wfsNamespaceUsed) {
- $featureType = $featureType->children('http://www.opengis.net/wfs');
- }
- $featuretype_name = $this->stripEndlineAndCarriageReturn($featureType->Name[0]);
- $featuretype_title = $this->stripEndlineAndCarriageReturn($featureType->Title[0]);
- $featuretype_abstract = $this->stripEndlineAndCarriageReturn($featureType->Abstract[0]);
+ $featuretype_name = $this->stripEndlineAndCarriageReturn($this->getValue($xpath, './wfs:Name/text()', $featureType));
+ $featuretype_title = $this->stripEndlineAndCarriageReturn($this->getValue($xpath, './wfs:Title/text()', $featureType));
+ $featuretype_abstract = $this->stripEndlineAndCarriageReturn($this->getValue($xpath, './wfs:Abstract/text()', $featureType));
//<DefaultSRS>urn:ogc:def:crs:EPSG::4326</DefaultSRS><OtherSRS>urn:ogc:def:crs:EPSG::4269</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::3978</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::3857</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::31466</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::25832</OtherSRS><OtherSRS>urn:ogc:def:crs:EPSG::4258</OtherSRS>
- $featuretype_srs = $featureType->DefaultCRS[0];
- $otherCRSArray = $featureType->OtherCRS;
+ $featuretype_srs = $this->getValue($xpath, './wfs:DefaultCRS/text()', $featureType);
+ $otherCRSArray = $xpath->query('./wfs:OtherCRS', $featureType);
foreach ($otherCRSArray as $otherCRS) {
- $e = new mb_notice("other crs: ".$otherCRS);
- $featuretype_crsArray[] = $otherCRS;
-
+ $crs = $this->getValue($xpath, './text()', $otherCRS);
+ $e = new mb_notice("other crs: ".$crs);
+ $featuretype_crsArray[] = $crs;
}
//<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;
+ $metadataURLArray = $xpath->query('./wfs:MetadataURL', $featureType);
$featuretype_metadataUrl = array();
$i_mdu = 0;
foreach ($metadataURLArray as $metadataURL) {
//$e = new mb_exception("other srs: ".$otherSRS);
- $featuretype_metadataUrl[$i_mdu]->href = $metadataURL->attributes()->xlinkhref;
- $e = new mb_notice("metadataurl: ".$metadataURL->attributes()->xlinkhref);
- $featuretype_metadataUrl[$i_mdu]->type = $metadataURL->attributes()->type;
+ $featuretype_metadataUrl[$i_mdu]->href = $this->getValue($xpath, './@xlink:href', $metadataURL);
+ $e = new mb_notice("metadataurl: ".$featuretype_metadataUrl[$i_mdu]->href);
+ $featuretype_metadataUrl[$i_mdu]->type = $this->getValue($xpath, './@type', $metadataURL);
$e = new mb_notice("type: ".$featuretype_metadataUrl[$i_mdu]->type);
- $featuretype_metadataUrl[$i_mdu]->format = $metadataURL->attributes()->format;
+ $featuretype_metadataUrl[$i_mdu]->format = $this->getValue($xpath, './@format', $metadataURL);
$e = new mb_notice("format: ".$featuretype_metadataUrl[$i_mdu]->format);
$i_mdu++;
}
//<ows:WGS84BoundingBox dimensions="2"><ows:LowerCorner>-9.16611817848171e+15 -3.4016616708962e+32</ows:LowerCorner><ows:UpperCorner>464605646503609 3.4016616708962e+32</ows:UpperCorner></ows:WGS84BoundingBox>
- $lowerCorner = $wfs20Cap->xpath('/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType['.$i.']/ows:WGS84BoundingBox/ows:LowerCorner');
- $lowerCorner = $lowerCorner[0];
- $lowerCorner = explode(" ",$lowerCorner);
+ $lowerCorner = explode(" ", $this->getValue($xpath, './ows:WGS84BoundingBox/ows:LowerCorner/text()', $featureType));
- $upperCorner = $wfs20Cap->xpath('/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType['.$i.']/ows:WGS84BoundingBox/ows:UpperCorner');
- $upperCorner = $upperCorner[0];
- $upperCorner = explode(" ",$upperCorner);
+ $upperCorner = explode(" ",$this->getValue($xpath, './ows:WGS84BoundingBox/ows:UpperCorner/text()', $featureType));
$featuretype_latlon_minx = $lowerCorner[0];
$featuretype_latlon_miny = $lowerCorner[1];
@@ -495,7 +469,7 @@
//get list of wfs operations
- $capOperations = $wfs20Cap->xpath('/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation');
+ $capOperations = $xpath->query('/wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation', $wfs20Cap);
$wfsOperations = array();
$listStoredQueriesUrl = "";
$describeStoredQueriesUrl = "";
@@ -503,16 +477,10 @@
foreach ($capOperations as $operation) {
//debug
#$e = new mb_notice("wfs operation: ".$operation->asXML());
+ $wfsOperations[$k]->name = html_entity_decode($this->getValue($xpath, './@name', $operation));
+ $wfsOperations[$k]->httpGet = html_entity_decode($this->getValue($xpath, './ows:DCP/ows:HTTP/ows:Get/@xlink:href', $operation));
+ $wfsOperations[$k]->httpPost = html_entity_decode($this->getValue($xpath, './ows:DCP/ows:HTTP/ows:Post/@xlink:href', $operation));
- $opName = $operation->xpath('@name');
- $wfsOperations[$k]->name = html_entity_decode($opName[0]->name);
-
- $httpGet = $operation->xpath('ows:DCP/ows:HTTP/ows:Get/@xlinkhref');
- $wfsOperations[$k]->httpGet = html_entity_decode($httpGet[0]->xlinkhref);
-
- $httpPost = $operation->xpath('ows:DCP/ows:HTTP/ows:Post/@xlinkhref');
- $wfsOperations[$k]->httpPost = html_entity_decode($httpPost[0]->xlinkhref);
-
//get url for ListStoredQueries request to go further on with createStoredQueryListFromUrlGet
if($wfsOperations[$k]->name == "ListStoredQueries") {
$listStoredQueriesUrl = $wfsOperations[$k]->httpGet;
@@ -555,5 +523,28 @@
$myWfs = new Wfs_2_0();
return parent::createFromDb($id, $myWfs);
}
+
+ protected function getValue($xpath, $xpathStr, $contextElm)
+ {
+ try {
+ $elm = $xpath->query($xpathStr, $contextElm)->item(0);
+ if(!$elm) {
+ return null;
+ }
+ if ($elm->nodeType == XML_ATTRIBUTE_NODE) {
+ return $elm->value;
+ } else if ($elm->nodeType == XML_TEXT_NODE) {
+ return $elm->wholeText;
+ } else if ($elm->nodeType == XML_ELEMENT_NODE) {
+ return $elm;
+ } else if ($elm->nodeType == XML_CDATA_SECTION_NODE) {
+ return $elm->wholeText;
+ } else {
+ return null;
+ }
+ } catch (Exception $E) {
+ return null;
+ }
+ }
}
?>
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2016-07-13 08:57:57 UTC (rev 9537)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2016-07-13 09:31:52 UTC (rev 9538)
@@ -522,7 +522,7 @@
$sql .= "wfs.wfs_title as servicetitle, wfs.wfs_version as serviceversion, wfs.wfs_abstract as serviceabstract, wfs.wfs_id as serviceid, wfs.fees, wfs.accessconstraints, wfs.individualname as contactperson, wfs.wfs_getcapabilities, wfs.wfs_describefeaturetype, ";
$sql .= "wfs.positionname as contactposition, wfs.providername as contactorganization, wfs.deliverypoint as address, wfs.city, wfs_timestamp as timestamp, wfs_owner as owner, wfs.wfs_owsproxy as owsproxy, wfs.fkey_mb_group_id,";
$sql .= "wfs.administrativearea as stateorprovince, wfs.postalcode as postcode, wfs.voice as contactvoicetelephone, wfs.facsimile as contactfacsimiletelephone, ";
- $sql .= "wfs.electronicmailaddress as contactelectronicmailaddress, wfs.country ";
+ $sql .= "wfs.electronicmailaddress as contactelectronicmailaddress, wfs.country, wfs_featuretype.featuretype_latlon_bbox as featuretype_latlon_bbox ";
$sql .= "FROM wfs_featuretype, wfs WHERE wfs_featuretype.featuretype_id = $1 AND wfs_featuretype.fkey_wfs_id = wfs.wfs_id LIMIT 1";
$v = array($featuretypeId);
$t = array('i');
@@ -701,6 +701,26 @@
$contentBboxes[$j]['maxx'] = $resourceMetadata['maxx'];
$contentBboxes[$j]['maxy'] = $resourceMetadata['maxy'];
}
+//db select for content properties
+if ($resource == 'wfs' || $resource == 'featuretype') {
+ //get bbox and crs codes for single layer - maybe some entries ;-)
+ $sql = "SELECT * FROM wfs_featuretype_epsg WHERE fkey_featuretype_id = $1";
+ $contentBboxes = array();
+ $v = array($featuretypeId);
+ $t = array('i');
+ $res = db_prep_query($sql, $v, $t);
+ $j = 0;
+ while ($row = db_fetch_array($res)){
+ $contentBboxes[$j] = array();
+ $contentBboxes[$j]['epsg'] = $row['epsg'];
+ $contentBboxes[$j]['minx'] = $row['minx'];
+ $contentBboxes[$j]['miny'] = $row['miny'];
+ $contentBboxes[$j]['maxx'] = $row['maxx'];
+ $contentBboxes[$j]['maxy'] = $row['maxy'];
+ $j++;
+ }
+ $j = 0;
+}
//generate HTML frame
//Give out page
@@ -1002,8 +1022,15 @@
}
if (($resource == 'featuretype') ) {
- $epsgString .= $resourceMetadata['featuretype_srs'];
+ for ($j = 0; $j < count($contentBboxes); $j++) {
+ $epsgString .= $contentBboxes[$j]['epsg']." ";
+ }
+
$html .= $t_a.$translation['crs'].$t_b.$epsgString.$t_c;
+ $help = $resourceMetadata['featuretype_latlon_bbox'];
+ if($resourceMetadata['featuretype_latlon_bbox'] && strlen($resourceMetadata['featuretype_latlon_bbox']) > 6){
+ $wgs84Bbox = $resourceMetadata['featuretype_latlon_bbox'];
+ }
}
if ($resource == 'wmc') {
@@ -1056,7 +1083,7 @@
}
//$html .= '</fieldset>';
}
-$html .= $tableEnd;
+
//Check if owsproxy is enabled for resource
if ($resource == 'featuretype' or $resource == 'wfs-conf' or $resource == "wfs") {
if ($admin->getWFSOWSstring($resourceMetadata['serviceid']) == false) {
@@ -1077,10 +1104,10 @@
#$html .= $t_a.$translation['describeFeaturetype'].$t_b."<a href='".$resourceMetadata['wfs_describefeaturetype']."&REQUEST=DescribeFeaturetype&typename=".$resourceMetadata['contentname']."' >Link</a>".$t_c;
}
-
if (isset($resourceMetadata['featuretype_geomType']) && ($resourceMetadata['featuretype_geomType'] != '')) {
$html .= $t_a.$translation['geomtype'].$t_b.$resourceMetadata['featuretype_geomType'].$t_c;
}
+$html .= $tableEnd;
if ($resource == 'wms' or $resource == 'layer'){
$html .= $tableBegin;
Modified: trunk/mapbender/http/php/mod_wfs_server.php
===================================================================
--- trunk/mapbender/http/php/mod_wfs_server.php 2016-07-13 08:57:57 UTC (rev 9537)
+++ trunk/mapbender/http/php/mod_wfs_server.php 2016-07-13 09:31:52 UTC (rev 9538)
@@ -30,7 +30,7 @@
$obj->url = getUpdateUrl($obj);
sendOutput($obj);
break;
- case 'add':
+ case 'add':
addConfsToGui($obj);
sendOutput($obj);
break;
More information about the Mapbender_commits
mailing list