changeset 266:1530890b28c9

Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause geo-backend/trunk@216 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 13 Oct 2009 14:30:52 +0000
parents e5379e129799
children 000e00592ba5
files geo-backend/ChangeLog geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java geo-backend/src/test/ressources/QueryExecutorTestCase.properties
diffstat 4 files changed, 39 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/geo-backend/ChangeLog	Tue Oct 13 13:20:26 2009 +0000
+++ b/geo-backend/ChangeLog	Tue Oct 13 14:30:52 2009 +0000
@@ -1,5 +1,14 @@
 2009-10-13  Tim Englich  <tim.englich@intevation.de>
 
+	* src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java (testSpatialQueryWithoutIntersects): 
+	  Added an TaesCase for Querying spatial Data without an spatial restriction
+	* src/test/ressources/QueryExecutorTestCase.properties: 
+	  Added TestQuery with no spatial restriction
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java (executeQuery): 
+	  Now it is possible to send spatial Quieries without an spatial restriction in the where clause.
+	
+2009-10-13  Tim Englich  <tim.englich@intevation.de>
+	
 	* src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java (validateObject) Edited:
 	  Added Tests if the Object is Closed. And add propper instance Tests 
 	* src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java (initialize):
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java	Tue Oct 13 13:20:26 2009 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java	Tue Oct 13 14:30:52 2009 +0000
@@ -1,7 +1,7 @@
 /**
 		*
 		*/
-	package de.intevation.gnv.geobackend.sde.datasources;
+package de.intevation.gnv.geobackend.sde.datasources;
 
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -14,7 +14,6 @@
 import com.esri.sde.sdk.client.SDEPoint;
 import com.esri.sde.sdk.client.SeColumnDefinition;
 import com.esri.sde.sdk.client.SeConnection;
-import com.esri.sde.sdk.client.SeCoordinateReference;
 import com.esri.sde.sdk.client.SeException;
 import com.esri.sde.sdk.client.SeFilter;
 import com.esri.sde.sdk.client.SeLayer;
@@ -24,7 +23,6 @@
 import com.esri.sde.sdk.client.SeShapeFilter;
 import com.esri.sde.sdk.client.SeSqlConstruct;
 import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.GeometryFactory;
 import com.vividsolutions.jts.io.WKTReader;
 
 
@@ -174,17 +172,19 @@
         try {
             // get the layer for querying
             SeLayer lLayer = new SeLayer(con, pLayername, pSpatialColumnName);
-            SeCoordinateReference cref = lLayer.getCoordRef();
-
-            SeShape shape = new SeShape();
-            shape.setCoordRef(lLayer.getCoordRef());
-            SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g);
-
-            shape.generatePolygon(lPoints.length, 1, null, lPoints);
-            SeShapeFilter filter = new SeShapeFilter(pLayername,
-                    pSpatialColumnName, shape, SeFilter.METHOD_AI);
-            SeShapeFilter[] filters = new SeShapeFilter[1];
-            filters[0] = filter;
+            SeShapeFilter[] filters  = null;
+            if (g != null){
+                SeShape shape = new SeShape();
+                shape.setCoordRef(lLayer.getCoordRef());
+                
+                SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g);
+    
+                shape.generatePolygon(lPoints.length, 1, null, lPoints);
+                SeShapeFilter filter = new SeShapeFilter(pLayername,
+                        pSpatialColumnName, shape, SeFilter.METHOD_AI);
+                filters = new SeShapeFilter[1];
+                filters[0] = filter;
+            }
 
             SeQuery spatialQuery = null;
             SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere);
@@ -193,8 +193,10 @@
             /*
              * Set spatial constraints
              */
-            spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false,
-                    filters);
+            if (filters != null){
+                spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false,
+                        filters);
+            }
             spatialQuery.execute();
 
             return this.handleResultSet(spatialQuery);
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java	Tue Oct 13 13:20:26 2009 +0000
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java	Tue Oct 13 14:30:52 2009 +0000
@@ -56,6 +56,15 @@
         }
     }
     
+    public void  testSpatialQueryWithoutIntersects(){
+            try {
+            this.testQuery(1332, "spatial_query_without_intersects", null);
+       } catch (QueryException e) {
+            log.error(e,e);
+            fail();
+        }
+    }
+    
     
     /**
      * Tests if the Databaseconnection can be established and
--- a/geo-backend/src/test/ressources/QueryExecutorTestCase.properties	Tue Oct 13 13:20:26 2009 +0000
+++ b/geo-backend/src/test/ressources/QueryExecutorTestCase.properties	Tue Oct 13 14:30:52 2009 +0000
@@ -18,4 +18,6 @@
          FROM MEDIAN.MESH m \
          WHERE M.OBJECTID = M.OBJECTID) AND \
          KPOSITION = 1 AND \
-         INTERSECTS(SHAPE,"POLYGON((6.483333296817733 56.50000002211891,6.483012102287745 56.50981053688071,6.48205002744038 56.51957897448855,6.480451095589132 56.52926359306454,6.478222179894658 56.538822818368885,6.475372835726546 56.54821591435217,6.471915300663454 56.557402480241024,6.46786415921693 56.56634328872852,6.463237181021697 56.57500011833619,6.458053812093169 56.583335585775785,6.452336348293812 56.591314319415915,6.446109264780915 56.59890195345352,6.439399383644684 56.60606613374233,6.432235203355873 56.61277601487856,6.424647569318296 56.61900309839146,6.416668835678138 56.62472056219082,6.408333368238544 56.629903931119344,6.399676538630871 56.63453090931458,6.390735730143376 56.6385820507611,6.381549164254523 56.64203958582419,6.372156068271238 56.644888929992305,6.362596842966894 56.64711784568678,6.352912224390906 56.64871677753803,6.34314378678306 56.64967885238539,6.333333272021264 56.65000004691538,6.323522757259468 56.64967885238539,6.31375431965165 56.64871677753803,6.304069701075662 56.64711784568678,6.29451047577129 56.644888929992305,6.285117379788005 56.64203958582419,6.27593081389918 56.6385820507611,6.266990005411657 56.63453090931458,6.258333343442075 56.629903931119344,6.24999770836439 56.62472056219082,6.24201897472426 56.61900309839146,6.234431340686655 56.61277601487856,6.227267160397872 56.60606613374233,6.220557279261612 56.59890195345352,6.214330195748715 56.591314319415915,6.2086127319493585 56.583335585775785,6.203429363020831 56.57500011833619,6.198802384825626 56.56634328872852,6.194751243379102 56.557402480241024,6.19129370831601 56.54821591435217,6.188444364147898 56.538822818368885,6.186215448453396 56.52926359306454,6.184616516602176 56.51957897448855,6.183654441754783 56.50981053688071,6.183333247224795 56.50000002211891,6.183654441754783 56.490189507357115,6.184616516602176 56.4804210697493,6.186215448453396 56.47073645117331,6.188444364147898 56.46117722586894,6.19129370831601 56.45178412988565,6.194751243379102 56.44259756399683,6.198802384825626 56.433656755509304,6.203429363020831 56.42500009353972,6.2086127319493585 56.41666445846204,6.214330195748715 56.40868572482191,6.220557279261612 56.4010980907843,6.227267160397872 56.39393391049552,6.234431340686655 56.38722402935926,6.24201897472426 56.38099694584636,6.24999770836439 56.375279482047006,6.258333343442075 56.37009611311848,6.266990005411657 56.36546913492327,6.27593081389918 56.36141799347675,6.285117379788005 56.35796045841366,6.29451047577129 56.355111114245545,6.304069701075662 56.35288219855104,6.31375431965165 56.351283266699795,6.323522757259468 56.35032119185243,6.333333272021264 56.34999999732244,6.34314378678306 56.35032119185243,6.352912224390906 56.351283266699795,6.362596842966894 56.35288219855104,6.372156068271238 56.355111114245545,6.381549164254523 56.35796045841366,6.390735730143376 56.36141799347675,6.399676538630871 56.36546913492327,6.408333368238544 56.37009611311848,6.416668835678138 56.375279482047006,6.424647569318296 56.38099694584636,6.432235203355873 56.38722402935926,6.439399383644684 56.39393391049552,6.446109264780915 56.4010980907843,6.452336348293812 56.40868572482191,6.458053812093169 56.41666445846204,6.463237181021697 56.42500009353972,6.46786415921693 56.433656755509304,6.471915300663454 56.44259756399683,6.475372835726546 56.45178412988565,6.478222179894658 56.46117722586894,6.480451095589132 56.47073645117331,6.48205002744038 56.4804210697493,6.483012102287745 56.490189507357115,6.483333296817733 56.50000002211891))")
\ No newline at end of file
+         INTERSECTS(SHAPE,"POLYGON((6.483333296817733 56.50000002211891,6.483012102287745 56.50981053688071,6.48205002744038 56.51957897448855,6.480451095589132 56.52926359306454,6.478222179894658 56.538822818368885,6.475372835726546 56.54821591435217,6.471915300663454 56.557402480241024,6.46786415921693 56.56634328872852,6.463237181021697 56.57500011833619,6.458053812093169 56.583335585775785,6.452336348293812 56.591314319415915,6.446109264780915 56.59890195345352,6.439399383644684 56.60606613374233,6.432235203355873 56.61277601487856,6.424647569318296 56.61900309839146,6.416668835678138 56.62472056219082,6.408333368238544 56.629903931119344,6.399676538630871 56.63453090931458,6.390735730143376 56.6385820507611,6.381549164254523 56.64203958582419,6.372156068271238 56.644888929992305,6.362596842966894 56.64711784568678,6.352912224390906 56.64871677753803,6.34314378678306 56.64967885238539,6.333333272021264 56.65000004691538,6.323522757259468 56.64967885238539,6.31375431965165 56.64871677753803,6.304069701075662 56.64711784568678,6.29451047577129 56.644888929992305,6.285117379788005 56.64203958582419,6.27593081389918 56.6385820507611,6.266990005411657 56.63453090931458,6.258333343442075 56.629903931119344,6.24999770836439 56.62472056219082,6.24201897472426 56.61900309839146,6.234431340686655 56.61277601487856,6.227267160397872 56.60606613374233,6.220557279261612 56.59890195345352,6.214330195748715 56.591314319415915,6.2086127319493585 56.583335585775785,6.203429363020831 56.57500011833619,6.198802384825626 56.56634328872852,6.194751243379102 56.557402480241024,6.19129370831601 56.54821591435217,6.188444364147898 56.538822818368885,6.186215448453396 56.52926359306454,6.184616516602176 56.51957897448855,6.183654441754783 56.50981053688071,6.183333247224795 56.50000002211891,6.183654441754783 56.490189507357115,6.184616516602176 56.4804210697493,6.186215448453396 56.47073645117331,6.188444364147898 56.46117722586894,6.19129370831601 56.45178412988565,6.194751243379102 56.44259756399683,6.198802384825626 56.433656755509304,6.203429363020831 56.42500009353972,6.2086127319493585 56.41666445846204,6.214330195748715 56.40868572482191,6.220557279261612 56.4010980907843,6.227267160397872 56.39393391049552,6.234431340686655 56.38722402935926,6.24201897472426 56.38099694584636,6.24999770836439 56.375279482047006,6.258333343442075 56.37009611311848,6.266990005411657 56.36546913492327,6.27593081389918 56.36141799347675,6.285117379788005 56.35796045841366,6.29451047577129 56.355111114245545,6.304069701075662 56.35288219855104,6.31375431965165 56.351283266699795,6.323522757259468 56.35032119185243,6.333333272021264 56.34999999732244,6.34314378678306 56.35032119185243,6.352912224390906 56.351283266699795,6.362596842966894 56.35288219855104,6.372156068271238 56.355111114245545,6.381549164254523 56.35796045841366,6.390735730143376 56.36141799347675,6.399676538630871 56.36546913492327,6.408333368238544 56.37009611311848,6.416668835678138 56.375279482047006,6.424647569318296 56.38099694584636,6.432235203355873 56.38722402935926,6.439399383644684 56.39393391049552,6.446109264780915 56.4010980907843,6.452336348293812 56.40868572482191,6.458053812093169 56.41666445846204,6.463237181021697 56.42500009353972,6.46786415921693 56.433656755509304,6.471915300663454 56.44259756399683,6.475372835726546 56.45178412988565,6.478222179894658 56.46117722586894,6.480451095589132 56.47073645117331,6.48205002744038 56.4804210697493,6.483012102287745 56.490189507357115,6.483333296817733 56.50000002211891))")
+
+spatial_query_without_intersects = SELECT  ST_ASTEXT(SHAPE) FROM MEDIAN.INSTANTANEOUSPOINT where SURVEYID = 1895

http://dive4elements.wald.intevation.org