On Thu, Sep 3, 2009 at 10:02 AM, Julian
Hagenauer<julian.hagena...@gmx.de> wrote:
> Hi,
> sorry for writing again. I hope i did not made it onto your ignorelist :-)
> Ok, because i can not solve my troubles with the wfs i decided to switch to 
> postgis. So good, so fine.
> Unfortunately my bbox-query provides some trouble.
> This is my db-connection and feature-aggregation code:
> DataStore dataStore = null;
>                try {
>                        dataStore = DataStoreFinder.getDataStore(m);
>                        Filter bbox = ff.bbox("the_geom", env.getMinX(), 
> env.getMinY(), env.getMaxX(), env.getMaxY(), null);
>                        FeatureSource featureSource = 
> dataStore.getFeatureSource(dataStore.getTypeNames()[i]);
>                        FeatureCollection fc = DataUtilities.collection( 
> featureSource.getFeatures( bbox ));
>
> Unfortunately this gives the following error:
> 03.09.2009 15:57:00 org.geotools.data.jdbc.JDBC1DataStore executeQuery
> SCHWERWIEGEND: Error Performing SQL query: SELECT "osm_id", "name", "type", 
> asText("the_geom") FROM "public"."naturals" WHERE "the_geom" && 
> GeometryFromText('POLYGON ((7.07 50.72, 7.07 50.75, 7.12 50.75, 7.12 50.72, 
> 7.07 50.72))', 4326) AND intersects("the_geom", GeometryFromText('POLYGON 
> ((7.07 50.72, 7.07 50.75, 7.12 50.75, 7.12 50.72, 7.07 50.72))', 4326))
> org.postgresql.util.PSQLException: ERROR: GEOS intersects() threw an error!
>        at 
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525)
>        at 
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
>        at 
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
>        at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
>        at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:340)
>        at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:239)
>        at 
> org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
>        at 
> org.geotools.data.jdbc.JDBC1DataStore.executeQuery(JDBC1DataStore.java:923)
>        at 
> org.geotools.data.jdbc.JDBC1DataStore.getFeatureReader(JDBC1DataStore.java:651)
>        at 
> org.geotools.data.jdbc.JDBCFeatureCollection.reader(JDBCFeatureCollection.java:88)
>        at 
> org.geotools.data.store.DataFeatureCollection.openIterator(DataFeatureCollection.java:229)
>        at 
> org.geotools.data.store.DataFeatureCollection.iterator(DataFeatureCollection.java:199)
>        at 
> org.geotools.feature.DefaultFeatureCollection.addAll(DefaultFeatureCollection.java:270)
>        at 
> org.geotools.feature.DefaultFeatureCollection.<init>(DefaultFeatureCollection.java:88)
>        at org.geotools.data.DataUtilities.collection(DataUtilities.java:1012)
>        at MyProg.loadFeaturesFromDB(MyProg.java:176)
>
> For debbuging i directly made the sql-query with pgadmin on my database:
> SELECT "osm_id", "name", "type", asText("the_geom") FROM "public"."naturals" 
> WHERE "the_geom" && GeometryFromText('POLYGON ((7.07 50.72, 7.07 50.75, 7.12 
> 50.75, 7.12 50.72, 7.07 50.72))', 4326) AND intersects("the_geom", 
> GeometryFromText('POLYGON ((7.07 50.72, 7.07 50.75, 7.12 50.75, 7.12 50.72, 
> 7.07 50.72))', 4326))
>
> Result is:
> NOTICE:  TopologyException: side location conflict (6.19793,50.5361,50.5361)
> ERROR:  GEOS intersects() threw an error!
>
> ********** Fehler **********
>
> ERROR: GEOS intersects() threw an error!
> SQL Status:XX000
>
> If i remove the second intersects after the "AND" everything works fine. So, 
> why does geotools use an AND-Statement, if it is not really necessary? Any 
> hint, how i can solve my problem?
>

I don't know why postgis is throwing the error but I do know why you
need the "and intersects" - && only does a quick bounding box
intersect so it may return true for a geometry that doesn't actually
intersect your bounding box, so for geometries who's bounding box
overlap your bbox you need to do the expensive intersects test.

Ian

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to