That did it. Thank you very much!
Julian
Original-Nachricht
Datum: Fri, 4 Sep 2009 09:33:55 +1000
Von: Jody Garnett jody.garn...@gmail.com
An: Julian Hagenauer julian.hagena...@gmx.de
CC: geotools-gt2-users@lists.sourceforge.net
Betreff: Re: [Geotools-gt2-users] BBOX query leads to SQL-Error
So some of the geometry in your database is not valid; do a select
with not isvalid to find the rows and either fix them (buffer(0) is a
good fix) or delete them.
Jody
On Fri, Sep 4, 2009 at 12:02 AM, Julian
Hagenauerjulian.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?
Thank you,
Julian
--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3
-
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
--
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