Procházet zdrojové kódy

updated WFS GetFeature bbox format - allow EPSG (QGIS 2.16)

Piotr Labudda před 9 roky
rodič
revize
95ae60e660
1 změnil soubory, kde provedl 7 přidání a 2 odebrání
  1. 7 2
      SE/se-lib/Api/WfsServerBase.php

+ 7 - 2
SE/se-lib/Api/WfsServerBase.php

@@ -84,7 +84,7 @@ class Api_WfsServerBase {
 		$args['wfs:featureID'] = null;// @from: featureID, featureId (featureid)
 		$args['primaryKey'] = null;// primaryKey type - @from: featureID
 
-		$lowerArgs = array(); foreach ($rawArgs as $name => $value) $lowerArgs[ strtolower($name) ] = $value;
+		$lowerArgs = array(); foreach ($rawArgs as $name => $value) $lowerArgs[ strtolower($name) ] = trim($value);
 
 		$args['xsd:type'] = V::get('typename', '', $lowerArgs);
 		$exType = explode(':', $args['xsd:type']);
@@ -125,7 +125,12 @@ class Api_WfsServerBase {
 
 		$args['bbox'] = V::get('bbox', '', $lowerArgs);
 		if (!empty($args['bbox'])) {
-			if (!preg_match("/^\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?$/", $args['bbox'], $matches)) throw new Exception("Wrong param BBOX");
+			// BBOX may have EPSG at then end - example: ",EPSG:4326"
+			if (!preg_match("/^\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?(\,EPSG:\d+)?$/", $args['bbox'], $matches)) throw new Exception("Wrong param BBOX");
+			if (preg_match("/\,EPSG:\d+$/", $args['bbox'], $matches)) {
+				$args['bbox'] = substr($args['bbox'], 0, strlen($args['bbox']) - strlen($matches[0]));
+			}
+			if (!preg_match("/^\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?,\d+(.\d+)?$/", $args['bbox'], $matches)) throw new Exception("Illegal BBOX format");
 			$searchParams['f_the_geom'] = "BBOX:{$args['bbox']}";
 		}