ソースを参照

TableAjaxMap: test bounds from wfs request

Piotr Labudda 11 年 前
コミット
836ede0bc2
1 ファイル変更65 行追加2 行削除
  1. 65 2
      SE/se-lib/TableAjaxMap.php

+ 65 - 2
SE/se-lib/TableAjaxMap.php

@@ -921,8 +921,56 @@ class TableAjaxMapWfsAction {
 		?>
 <wfs:FeatureCollection xmlns:nasa="http://nasa.gov" xmlns:topp="http://www.openplans.org/topp" xmlns:usgs="http://www.usgs.gov/" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ows="http://www.opengis.net/ows" xmlns:ne="http://naturalearthdata.com" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:osm="http://openstreemap.org" xmlns:nurc="http://www.nurc.nato.int" xmlns:og="http://opengeo.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfFeatures="4" timeStamp="2014-07-16T13:22:43.307Z" xsi:schemaLocation="http://opengeo.org http://demo.opengeo.org:80/geoserver/wfs?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;typeName=og%3Arestricted http://www.opengis.net/wfs http://demo.opengeo.org:80/geoserver/schemas/wfs/1.1.0/wfs.xsd">
 <!--
-<?php echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($this->_zasobID);echo'</pre>'; ?>
-<?php echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($buildingsGml);echo'</pre>'; ?>
+<?php
+/*
+ * gdańsk
+		<gml:lowerCorner>17.226562502593 53.887024366231</gml:lowerCorner>
+		<gml:upperCorner>20.039062502593 54.847089981191</gml:upperCorner>
+ * chełm CI50, 58, 56 i większa część 54
+		<gml:lowerCorner>18.607629912267 54.334071453085</gml:lowerCorner>
+		<gml:upperCorner>18.618616240393 54.337824603267</gml:upperCorner>
+ * chełm CI50, 58, 56 i mniejsza część 54
+		<gml:lowerCorner>18.607297318347 54.334218457914</gml:lowerCorner>
+		<gml:upperCorner>18.618283646473 54.337971594678</gml:upperCorner>
+ */
+$bounds = "Polygon((17.226562502593 53.887024366231, 20.039062502593 54.847089981191))";
+
+$bounds = "POLYGON((
+	18.61292099002325 54.33645952913529,
+	18.612985363039602 54.33478310873356,
+	18.616246929201676 54.33477685330538,
+	18.61613964084169 54.336309404721554,
+	18.61292099002325 54.33645952913529
+))";
+$bounds = "POLYGON((
+	17.226562502593 53.887024366231,
+17.226562502593 54.847089981191,
+	20.039062502593 54.847089981191,
+20.039062502593 53.887024366231,
+	17.226562502593 53.887024366231
+))";
+$bounds = "POLYGON((
+	18.607297318347 54.334218457914,
+18.607297318347 54.337971594678,
+	18.618283646473 54.337971594678,
+18.618283646473 54.334218457914,
+	18.607297318347 54.334218457914
+))";
+$sql = "select t.`ID`
+		, t.`S_ADDRESS_STREET`
+		, AsWKT(t.`the_geom`) as the_geomWKT
+		, AsWKT(GeomFromText('{$bounds}')) as boundsWKT
+		, MBRWithin(GeomFromText('{$bounds}'), GeomFromText(AsWKT(t.`the_geom`))) as isInside
+		, MBRWithin(GeomFromText(AsWKT(t.`the_geom`)), GeomFromText('{$bounds}')) as isInside2
+	from `BUILDINGS` as t
+	where t.`the_geom` is not null
+	limit 10 ";
+echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): '."\n";print_r($sql);echo "\n".'</pre>';
+$res = $db->query($sql);
+while ($r = $db->fetch($res)) {
+	echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($r);echo'</pre>';
+}
+?>
 -->
   <gml:boundedBy>
     <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
@@ -1000,6 +1048,21 @@ class TableAjaxMapWpsServer {
 
 		if ('GetFeature' == $xml->getName()) {
 			// TODO: parse xml and set query params
+			/*
+<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd http://opengeo.org http://demo.opengeo.org/geoserver/wfs/DescribeFeatureType?version=1.1.0&amp;typename=og:restricted">
+  <wfs:Query typeName="feature:restricted" srsName="EPSG:4326" xmlns:feature="http://opengeo.org">
+    <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+      <ogc:BBOX>
+        <ogc:PropertyName>the_geom</ogc:PropertyName>
+        <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
+          <gml:lowerCorner>17.226562502593 53.887024366231</gml:lowerCorner>
+          <gml:upperCorner>20.039062502593 54.847089981191</gml:upperCorner>
+        </gml:Envelope>
+      </ogc:BBOX>
+    </ogc:Filter>
+  </wfs:Query>
+</wfs:GetFeature>
+			 */
 			$this->_wfsAction->execute($data);
 		}
 		else if (isset($xml->children('ows', TRUE)->Identifier)) {