[fusion-commits] r1984 - trunk/widgets/Query/classes

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Nov 19 21:42:28 EST 2009


Author: christinebao
Date: 2009-11-19 21:42:27 -0500 (Thu, 19 Nov 2009)
New Revision: 1984

Modified:
   trunk/widgets/Query/classes/query.php
Log:
Fix ticket http://trac.osgeo.org/fusion/ticket/328
Query: Polygon query doesn't work against SQL Server Spatial Provider

Modified: trunk/widgets/Query/classes/query.php
===================================================================
--- trunk/widgets/Query/classes/query.php	2009-11-18 16:08:27 UTC (rev 1983)
+++ trunk/widgets/Query/classes/query.php	2009-11-20 02:42:27 UTC (rev 1984)
@@ -548,6 +548,13 @@
             $coords->Add($coord);
         }
 
+        //Some provider such as SQL Server Spatial, ODBC requires the polygon's start point must be the same as end point.
+        if(($count>2) && (($coords->GetItem(0)->GetX() != $coords->GetItem($count-1)->GetX()) || ($coords->GetItem(0)->GetY() != $coords->GetItem($count-1)->GetY())))
+        {
+            $coord = $geometryFactory->CreateCoordinateXY($coords->GetItem(0)->GetX(), $coords->GetItem(0)->GetY());
+            $coords->Add($coord);
+        }
+        
         $linearRing = $geometryFactory->CreateLinearRing($coords);
         $polygon = $geometryFactory->CreatePolygon($linearRing, null);
 



More information about the fusion-commits mailing list