|
|
|
Jody Garnett-2
|
Gabriel / Mark - here is the results of testing GeoServer 1.7.7
against udig + geotools trunk. Everything is looking okay; except for WFS Editing - looks like a change on the geotools side to me? Or a change in what the renderer is sending to the WFS DataStore? Jody net.refractions.udig.project.render.RenderException: Problem rendering: Exception rendering layer DefaultMapLayer[ Test, VISIBLE, UNSELECTED, style=StyleImpl[ name=Default Styler], data=net.refractions.udig.project.internal.impl.UDIGFeatureStore@1b3409f, query=Query: [Request All Features] feature type: null filter: Filter.INCLUDE [properties: ALL ]] at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:368) at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:213) at net.refractions.udig.project.internal.render.impl.RenderJob.startRendering(RenderJob.java:108) at net.refractions.udig.project.internal.render.impl.RenderJob.run(RenderJob.java:213) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: java.lang.Exception: Exception rendering layer DefaultMapLayer[ Test, VISIBLE, UNSELECTED, style=StyleImpl[ name=Default Styler], data=net.refractions.udig.project.internal.impl.UDIGFeatureStore@1b3409f, query=Query: [Request All Features] feature type: null filter: Filter.INCLUDE [properties: ALL ]] at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:679) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:501) at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:340) ... 4 more Caused by: java.lang.ClassCastException: org.geotools.renderer.lite.FastBBOX cannot be cast to org.geotools.filter.Filter at org.geotools.filter.Filters.accept(Filters.java:262) at org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy.correctFilterForServer(NonStrictWFSStrategy.java:213) at org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy.getFeatureReader(NonStrictWFSStrategy.java:69) at org.geotools.data.wfs.v1_0_0.WFS_1_0_0_DataStore.getFeatureReader(WFS_1_0_0_DataStore.java:729) at org.geotools.data.DefaultFeatureResults.reader(DefaultFeatureResults.java:210) at org.geotools.data.store.DataFeatureCollection.openIterator(DataFeatureCollection.java:224) at org.geotools.data.store.DataFeatureCollection.iterator(DataFeatureCollection.java:194) at org.geotools.renderer.lite.StreamingRenderer.drawOptimized(StreamingRenderer.java:1796) at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1730) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:675) ... 6 more ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Gabriel Roldan
|
Hi Jody,
want to try the attached patch? This is the deal: I didn't want to touch anything but the wfs 1.0 datastore. Made a test case that uses a BBOX implementation that does not implement the deprecated geotools' GeometryFilter and reproduced the issue. Then used DuplicatingFilterVisitor to make sure the the query filter is of the expected types. Sort of band aid solution, but as long as wfs 1.0 datastore is kind of unmaintained, I would say it's good enough until porting it to the new architecture. Thoughts? Cheers, Gabriel Jody Garnett wrote: > Gabriel / Mark - here is the results of testing GeoServer 1.7.7 > against udig + geotools trunk. > > Everything is looking okay; except for WFS Editing - looks like a > change on the geotools side to me? Or a change in what the renderer is > sending to the WFS DataStore? > > Jody > > net.refractions.udig.project.render.RenderException: Problem > rendering: Exception rendering layer DefaultMapLayer[ Test, VISIBLE, > UNSELECTED, style=StyleImpl[ name=Default Styler], > data=net.refractions.udig.project.internal.impl.UDIGFeatureStore@1b3409f, > query=Query: [Request All Features] > feature type: null > filter: Filter.INCLUDE > [properties: ALL ]] > at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:368) > at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:213) > at net.refractions.udig.project.internal.render.impl.RenderJob.startRendering(RenderJob.java:108) > at net.refractions.udig.project.internal.render.impl.RenderJob.run(RenderJob.java:213) > at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) > Caused by: java.lang.Exception: Exception rendering layer > DefaultMapLayer[ Test, VISIBLE, UNSELECTED, style=StyleImpl[ > name=Default Styler], > data=net.refractions.udig.project.internal.impl.UDIGFeatureStore@1b3409f, > query=Query: [Request All Features] > feature type: null > filter: Filter.INCLUDE > [properties: ALL ]] > at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:679) > at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:501) > at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:340) > ... 4 more > Caused by: java.lang.ClassCastException: > org.geotools.renderer.lite.FastBBOX cannot be cast to > org.geotools.filter.Filter > at org.geotools.filter.Filters.accept(Filters.java:262) > at org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy.correctFilterForServer(NonStrictWFSStrategy.java:213) > at org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy.getFeatureReader(NonStrictWFSStrategy.java:69) > at org.geotools.data.wfs.v1_0_0.WFS_1_0_0_DataStore.getFeatureReader(WFS_1_0_0_DataStore.java:729) > at org.geotools.data.DefaultFeatureResults.reader(DefaultFeatureResults.java:210) > at org.geotools.data.store.DataFeatureCollection.openIterator(DataFeatureCollection.java:224) > at org.geotools.data.store.DataFeatureCollection.iterator(DataFeatureCollection.java:194) > at org.geotools.renderer.lite.StreamingRenderer.drawOptimized(StreamingRenderer.java:1796) > at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1730) > at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:675) > ... 6 more -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. Index: src/main/java/org/geotools/data/wfs/v1_0_0/WFS_1_0_0_DataStore.java =================================================================== --- src/main/java/org/geotools/data/wfs/v1_0_0/WFS_1_0_0_DataStore.java (revision 34115) +++ src/main/java/org/geotools/data/wfs/v1_0_0/WFS_1_0_0_DataStore.java (working copy) @@ -72,6 +72,7 @@ import org.geotools.filter.Filters; import org.geotools.filter.GeometryFilter; import org.geotools.filter.LiteralExpression; +import org.geotools.filter.visitor.DuplicatingFilterVisitor; import org.geotools.filter.visitor.PostPreProcessFilterSplittingVisitor; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.referencing.CRS; @@ -472,6 +473,15 @@ } if (request != null) { + if (request.getFilter() != null) { + // duplicate the filter so we're sure it uses the old and deprecated interfaces. + // Weird? yes. WFS 1.0 support is still not ported to the GeoAPI Filter interfaces + DefaultQuery q = new DefaultQuery(request); + DuplicatingFilterVisitor dfv = new DuplicatingFilterVisitor(); + Filter duplicated = (Filter) request.getFilter().accept(dfv, null); + q.setFilter(duplicated); + request = q; + } if (request.getMaxFeatures() != Query.DEFAULT_MAX) { url += ("&MAXFEATURES=" + request.getMaxFeatures()); } @@ -661,6 +671,15 @@ hints.put(DocumentWriter.BASE_ELEMENT, WFSSchema.getInstance().getElements()[2]); // GetFeature hints.put(DocumentWriter.ENCODING, protocolHandler.getEncoding()); try { + if (query.getFilter() != null) { + // duplicate the filter so we're sure it uses the old and deprecated interfaces. + // Weird? yes. WFS 1.0 support is still not ported to the GeoAPI Filter interfaces + DefaultQuery q = new DefaultQuery(query); + DuplicatingFilterVisitor dfv = new DuplicatingFilterVisitor(); + Filter duplicated = (Filter) query.getFilter().accept(dfv, null); + q.setFilter(duplicated); + query = q; + } DocumentWriter.writeDocument(query, WFSSchema.getInstance(), w, hints); } catch (OperationNotSupportedException e) { LOGGER.warning(e.toString()); Index: src/test/java/org/geotools/data/wfs/v1_0_0/GeoServerOnlineTest.java =================================================================== --- src/test/java/org/geotools/data/wfs/v1_0_0/GeoServerOnlineTest.java (revision 34115) +++ src/test/java/org/geotools/data/wfs/v1_0_0/GeoServerOnlineTest.java (working copy) @@ -54,16 +54,20 @@ import org.geotools.feature.IllegalAttributeException; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.filter.IllegalFilterException; +import org.geotools.geometry.jts.ReferencedEnvelope; import org.junit.Before; import org.junit.Test; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; import org.opengis.filter.Filter; import org.opengis.filter.FilterFactory2; +import org.opengis.filter.FilterVisitor; import org.opengis.filter.Id; import org.opengis.filter.PropertyIsNull; +import org.opengis.filter.expression.Expression; import org.opengis.filter.expression.PropertyName; import org.opengis.filter.identity.FeatureId; +import org.opengis.filter.spatial.BBOX; import org.xml.sax.SAXException; import com.vividsolutions.jts.geom.Coordinate; @@ -232,7 +236,77 @@ WFSDataStoreReadTest.doFeatureReaderWithQuery(url, true, false, 0); } + /** + * {@link BBOX} support? + */ @Test + public void testDataStoreSupportsPlainBBOXInterface() throws Exception { + final WFS_1_0_0_DataStore wfs = WFSDataStoreReadTest.getDataStore(url); + final SimpleFeatureType ft = wfs.getSchema(TO_EDIT_TYPE); + final ReferencedEnvelope bounds = wfs.getFeatureSource(TO_EDIT_TYPE).getBounds(); + + final FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints()); + final BBOX bbox = ff.bbox("the_geom", bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY(), null); + + /** + * This one does not implement the deprecated geotools filter interfaces + */ + final BBOX strictBBox = new BBOX() { + + public boolean evaluate(Object object) { + return bbox.evaluate(object); + } + + public Object accept(FilterVisitor visitor, Object extraData) { + return bbox.accept(visitor, extraData); + } + + public Expression getExpression2() { + return bbox.getExpression2(); + } + + public Expression getExpression1() { + return bbox.getExpression1(); + } + + public String getSRS() { + return bbox.getSRS(); + } + + public String getPropertyName() { + return bbox.getPropertyName(); + } + + public double getMinY() { + return bbox.getMinY(); + } + + public double getMinX() { + return bbox.getMinX(); + } + + public double getMaxY() { + return bbox.getMaxY(); + } + + public double getMaxX() { + return bbox.getMaxX(); + } + }; + + final DefaultQuery query = new DefaultQuery(ft.getTypeName()); + query.setFilter(strictBBox); + + FeatureReader<SimpleFeatureType, SimpleFeature> reader; + + reader = wfs.getFeatureReaderGet(query, Transaction.AUTO_COMMIT); + assertNotNull(reader); + + reader = wfs.getFeatureReaderPost(query, Transaction.AUTO_COMMIT); + assertNotNull(reader); + } + + @Test public void testFeatureReaderWithFilterPOST() throws NoSuchElementException, IllegalAttributeException, IOException, SAXException { WFSDataStoreReadTest.doFeatureReaderWithQuery(url, false, true, 0); ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Jody Garnett-2
|
Hi again;
So I did try the patch; and also tried applying it right before the strategy call - basically the duplicating feature visitor creates a FastBBOX out the other side (at least when I checked in the debugger) so the patch did not work for me. Jody On 14/10/2009, at 3:04 AM, Gabriel Roldan wrote: > Hi Jody, > > want to try the attached patch? > > This is the deal: I didn't want to touch anything but the wfs 1.0 > datastore. Made a test case that uses a BBOX implementation that > does not implement the deprecated geotools' GeometryFilter and > reproduced the issue. > Then used DuplicatingFilterVisitor to make sure the the query filter > is of the expected types. > Sort of band aid solution, but as long as wfs 1.0 datastore is kind > of unmaintained, I would say it's good enough until porting it to > the new architecture. > > Thoughts? > > Cheers, > Gabriel ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Gabriel Roldan
|
Strange, the only reference to FastBBOX I found is in
StreamingRenderer.createBBoxFilters, and it's a straight instantiation... gonna try and update my udig dev env, keep you posted. Gabriel Jody Garnett wrote: > Hi again; > > So I did try the patch; and also tried applying it right before the > strategy call - basically the duplicating feature visitor creates a > FastBBOX out the other side (at least when I checked in the debugger) so > the patch did not work for me. > > Jody > > On 14/10/2009, at 3:04 AM, Gabriel Roldan wrote: >> Hi Jody, >> >> want to try the attached patch? >> >> This is the deal: I didn't want to touch anything but the wfs 1.0 >> datastore. Made a test case that uses a BBOX implementation that does >> not implement the deprecated geotools' GeometryFilter and reproduced >> the issue. >> Then used DuplicatingFilterVisitor to make sure the the query filter >> is of the expected types. >> Sort of band aid solution, but as long as wfs 1.0 datastore is kind of >> unmaintained, I would say it's good enough until porting it to the new >> architecture. >> >> Thoughts? >> >> Cheers, >> Gabriel > -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Gabriel Roldan
|
Gabriel Roldan wrote:
> Strange, the only reference to FastBBOX I found is in > StreamingRenderer.createBBoxFilters, and it's a straight instantiation... > gonna try and update my udig dev env, keep you posted. can't do now, udig's confluence seems to be down and I'd need to go through the dev guide. Gonna try later. Cheers, Gabriel > > Gabriel > Jody Garnett wrote: >> Hi again; >> >> So I did try the patch; and also tried applying it right before the >> strategy call - basically the duplicating feature visitor creates a >> FastBBOX out the other side (at least when I checked in the debugger) so >> the patch did not work for me. >> >> Jody >> >> On 14/10/2009, at 3:04 AM, Gabriel Roldan wrote: >>> Hi Jody, >>> >>> want to try the attached patch? >>> >>> This is the deal: I didn't want to touch anything but the wfs 1.0 >>> datastore. Made a test case that uses a BBOX implementation that does >>> not implement the deprecated geotools' GeometryFilter and reproduced >>> the issue. >>> Then used DuplicatingFilterVisitor to make sure the the query filter >>> is of the expected types. >>> Sort of band aid solution, but as long as wfs 1.0 datastore is kind of >>> unmaintained, I would say it's good enough until porting it to the new >>> architecture. >>> >>> Thoughts? >>> >>> Cheers, >>> Gabriel > > -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Jody Garnett-2
|
CHanging the geotools quickstart code to hit WFS should also do it I
expect? Jody On 15/10/2009, at 1:01 AM, Gabriel Roldan wrote: > Gabriel Roldan wrote: >> Strange, the only reference to FastBBOX I found is in >> StreamingRenderer.createBBoxFilters, and it's a straight >> instantiation... >> gonna try and update my udig dev env, keep you posted. > can't do now, udig's confluence seems to be down and I'd need to go > through the dev guide. Gonna try later. > > Cheers, > Gabriel >> Gabriel >> Jody Garnett wrote: >>> Hi again; >>> >>> So I did try the patch; and also tried applying it right before >>> the strategy call - basically the duplicating feature visitor >>> creates a FastBBOX out the other side (at least when I checked in >>> the debugger) so the patch did not work for me. >>> >>> Jody >>> >>> On 14/10/2009, at 3:04 AM, Gabriel Roldan wrote: >>>> Hi Jody, >>>> >>>> want to try the attached patch? >>>> >>>> This is the deal: I didn't want to touch anything but the wfs 1.0 >>>> datastore. Made a test case that uses a BBOX implementation that >>>> does not implement the deprecated geotools' GeometryFilter and >>>> reproduced the issue. >>>> Then used DuplicatingFilterVisitor to make sure the the query >>>> filter is of the expected types. >>>> Sort of band aid solution, but as long as wfs 1.0 datastore is >>>> kind of unmaintained, I would say it's good enough until porting >>>> it to the new architecture. >>>> >>>> Thoughts? >>>> >>>> Cheers, >>>> Gabriel > > > -- > Gabriel Roldan > OpenGeo - http://opengeo.org > Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Gabriel Roldan
|
In reply to this post
by Gabriel Roldan
Jody Garnett wrote:
> yeah; although I thought I sent you the source code. > Sorry to be lame on this one; I am on IRC if you want to chat. > > I could not understand how the duplicating filter visitor was not > replacing the FastBBOX; but did not get to step through it. Neither do I. By the look of it it seems impossible. So it might just be the duplication not applied in the right place. Try the attached patch. Following the code it looks like the missing place was DataStore.getFeatureReader(Query, Transaction) Cheers, Gabriel > > Jody > > On 15/10/2009, at 12:47 AM, Gabriel Roldan wrote: > >> I didn't get the patch, nor is it on my spam quarantine folder. But I >> did get you email saying you applied the visitor right in the WFS >> strategy object and it didn't work neither. Is that what you mean? >> >> Gabriel >> Jody Garnett wrote: >>> I am afraid "clone" may be around? >>> I think I sent you a second patch in an earlier email? In anycase I >>> did the patch on a work machine and cannot fetch it for you now. >>> Jody >>> On 15/10/2009, at 12:32 AM, Gabriel Roldan wrote: >>>> Strange, the only reference to FastBBOX I found is in >>>> StreamingRenderer.createBBoxFilters, and it's a straight >>>> instantiation... >>>> gonna try and update my udig dev env, keep you posted. >>>> >>>> Gabriel >>>> Jody Garnett wrote: >>>>> Hi again; >>>>> So I did try the patch; and also tried applying it right before the >>>>> strategy call - basically the duplicating feature visitor creates a >>>>> FastBBOX out the other side (at least when I checked in the >>>>> debugger) so the patch did not work for me. >>>>> Jody >>>>> On 14/10/2009, at 3:04 AM, Gabriel Roldan wrote: >>>>>> Hi Jody, >> > -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. Index: src/test/java/org/geotools/data/wfs/v1_0_0/GeoServerOnlineTest.java =================================================================== --- src/test/java/org/geotools/data/wfs/v1_0_0/GeoServerOnlineTest.java (revision 34145) +++ src/test/java/org/geotools/data/wfs/v1_0_0/GeoServerOnlineTest.java (working copy) @@ -54,16 +54,20 @@ import org.geotools.feature.IllegalAttributeException; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.filter.IllegalFilterException; +import org.geotools.geometry.jts.ReferencedEnvelope; import org.junit.Before; import org.junit.Test; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; import org.opengis.filter.Filter; import org.opengis.filter.FilterFactory2; +import org.opengis.filter.FilterVisitor; import org.opengis.filter.Id; import org.opengis.filter.PropertyIsNull; +import org.opengis.filter.expression.Expression; import org.opengis.filter.expression.PropertyName; import org.opengis.filter.identity.FeatureId; +import org.opengis.filter.spatial.BBOX; import org.xml.sax.SAXException; import com.vividsolutions.jts.geom.Coordinate; @@ -232,7 +236,77 @@ WFSDataStoreReadTest.doFeatureReaderWithQuery(url, true, false, 0); } + /** + * {@link BBOX} support? + */ @Test + public void testDataStoreSupportsPlainBBOXInterface() throws Exception { + final WFS_1_0_0_DataStore wfs = WFSDataStoreReadTest.getDataStore(url); + final SimpleFeatureType ft = wfs.getSchema(TO_EDIT_TYPE); + final ReferencedEnvelope bounds = wfs.getFeatureSource(TO_EDIT_TYPE).getBounds(); + + final FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints()); + final BBOX bbox = ff.bbox("the_geom", bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY(), null); + + /** + * This one does not implement the deprecated geotools filter interfaces + */ + final BBOX strictBBox = new BBOX() { + + public boolean evaluate(Object object) { + return bbox.evaluate(object); + } + + public Object accept(FilterVisitor visitor, Object extraData) { + return bbox.accept(visitor, extraData); + } + + public Expression getExpression2() { + return bbox.getExpression2(); + } + + public Expression getExpression1() { + return bbox.getExpression1(); + } + + public String getSRS() { + return bbox.getSRS(); + } + + public String getPropertyName() { + return bbox.getPropertyName(); + } + + public double getMinY() { + return bbox.getMinY(); + } + + public double getMinX() { + return bbox.getMinX(); + } + + public double getMaxY() { + return bbox.getMaxY(); + } + + public double getMaxX() { + return bbox.getMaxX(); + } + }; + + final DefaultQuery query = new DefaultQuery(ft.getTypeName()); + query.setFilter(strictBBox); + + FeatureReader<SimpleFeatureType, SimpleFeature> reader; + + reader = wfs.getFeatureReaderGet(query, Transaction.AUTO_COMMIT); + assertNotNull(reader); + + reader = wfs.getFeatureReaderPost(query, Transaction.AUTO_COMMIT); + assertNotNull(reader); + } + + @Test public void testFeatureReaderWithFilterPOST() throws NoSuchElementException, IllegalAttributeException, IOException, SAXException { WFSDataStoreReadTest.doFeatureReaderWithQuery(url, false, true, 0); Index: src/main/java/org/geotools/data/wfs/v1_0_0/WFS_1_0_0_DataStore.java =================================================================== --- src/main/java/org/geotools/data/wfs/v1_0_0/WFS_1_0_0_DataStore.java (revision 34145) +++ src/main/java/org/geotools/data/wfs/v1_0_0/WFS_1_0_0_DataStore.java (working copy) @@ -72,6 +72,7 @@ import org.geotools.filter.Filters; import org.geotools.filter.GeometryFilter; import org.geotools.filter.LiteralExpression; +import org.geotools.filter.visitor.DuplicatingFilterVisitor; import org.geotools.filter.visitor.PostPreProcessFilterSplittingVisitor; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.referencing.CRS; @@ -472,6 +473,15 @@ } if (request != null) { + if (request.getFilter() != null) { + // duplicate the filter so we're sure it uses the old and deprecated interfaces. + // Weird? yes. WFS 1.0 support is still not ported to the GeoAPI Filter interfaces + DefaultQuery q = new DefaultQuery(request); + DuplicatingFilterVisitor dfv = new DuplicatingFilterVisitor(); + Filter duplicated = (Filter) request.getFilter().accept(dfv, null); + q.setFilter(duplicated); + request = q; + } if (request.getMaxFeatures() != Query.DEFAULT_MAX) { url += ("&MAXFEATURES=" + request.getMaxFeatures()); } @@ -661,6 +671,15 @@ hints.put(DocumentWriter.BASE_ELEMENT, WFSSchema.getInstance().getElements()[2]); // GetFeature hints.put(DocumentWriter.ENCODING, protocolHandler.getEncoding()); try { + if (query.getFilter() != null) { + // duplicate the filter so we're sure it uses the old and deprecated interfaces. + // Weird? yes. WFS 1.0 support is still not ported to the GeoAPI Filter interfaces + DefaultQuery q = new DefaultQuery(query); + DuplicatingFilterVisitor dfv = new DuplicatingFilterVisitor(); + Filter duplicated = (Filter) query.getFilter().accept(dfv, null); + q.setFilter(duplicated); + query = q; + } DocumentWriter.writeDocument(query, WFSSchema.getInstance(), w, hints); } catch (OperationNotSupportedException e) { LOGGER.warning(e.toString()); @@ -726,6 +745,15 @@ */ public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(Query query, Transaction transaction) throws IOException { + if (query.getFilter() != null) { + // duplicate the filter so we're sure it uses the old and deprecated interfaces. + // Weird? yes. WFS 1.0 support is still not ported to the GeoAPI Filter interfaces + DefaultQuery q = new DefaultQuery(query); + DuplicatingFilterVisitor dfv = new DuplicatingFilterVisitor(); + Filter duplicated = (Filter) query.getFilter().accept(dfv, null); + q.setFilter(duplicated); + query = q; + } return strategy.getFeatureReader(query, transaction); } ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Jody Garnett-2
|
In reply to this post
by Jody Garnett-2
Gabriel I have committed QuickstartWFS to the demo/example project
which does illustrate the problem. You need to be sure to include VERSION=1.0.0 ... Jody On 15/10/2009, at 1:08 AM, Jody Garnett wrote: > CHanging the geotools quickstart code to hit WFS should also do it I > expect? > > Jody > > On 15/10/2009, at 1:01 AM, Gabriel Roldan wrote: > >> Gabriel Roldan wrote: >>> Strange, the only reference to FastBBOX I found is in >>> StreamingRenderer.createBBoxFilters, and it's a straight >>> instantiation... >>> gonna try and update my udig dev env, keep you posted. >> can't do now, udig's confluence seems to be down and I'd need to go >> through the dev guide. Gonna try later. >> >> Cheers, >> Gabriel >>> Gabriel >>> Jody Garnett wrote: >>>> Hi again; >>>> >>>> So I did try the patch; and also tried applying it right before >>>> the strategy call - basically the duplicating feature visitor >>>> creates a FastBBOX out the other side (at least when I checked in >>>> the debugger) so the patch did not work for me. >>>> >>>> Jody >>>> >>>> On 14/10/2009, at 3:04 AM, Gabriel Roldan wrote: >>>>> Hi Jody, >>>>> >>>>> want to try the attached patch? >>>>> >>>>> This is the deal: I didn't want to touch anything but the wfs >>>>> 1.0 datastore. Made a test case that uses a BBOX implementation >>>>> that does not implement the deprecated geotools' GeometryFilter >>>>> and reproduced the issue. >>>>> Then used DuplicatingFilterVisitor to make sure the the query >>>>> filter is of the expected types. >>>>> Sort of band aid solution, but as long as wfs 1.0 datastore is >>>>> kind of unmaintained, I would say it's good enough until porting >>>>> it to the new architecture. >>>>> >>>>> Thoughts? >>>>> >>>>> Cheers, >>>>> Gabriel >> >> >> -- >> Gabriel Roldan >> OpenGeo - http://opengeo.org >> Expert service straight from the developers. > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Gabriel Roldan
|
In reply to this post
by Gabriel Roldan
I know why it doesn't work, FastBBOX is tricky, it defeats the purpose
of DuplicatingFilterVisitor: public Object accept(FilterVisitor visitor, Object context) { Object result = visitor.visit(this, context); if(!(result instanceof BBOX)) return result; BBOX clone = (BBOX) result; if(clone.getExpression1().equals(getExpression1()) && clone.getExpression2().equals(getExpression2())) return new FastBBOX(property, envelope); return result; } gonna see what else could be done Gabriel Roldan wrote: > Jody Garnett wrote: >> yeah; although I thought I sent you the source code. >> Sorry to be lame on this one; I am on IRC if you want to chat. >> >> I could not understand how the duplicating filter visitor was not >> replacing the FastBBOX; but did not get to step through it. > Neither do I. By the look of it it seems impossible. So it might just be > the duplication not applied in the right place. > Try the attached patch. Following the code it looks like the missing > place was DataStore.getFeatureReader(Query, Transaction) > > Cheers, > Gabriel >> >> Jody >> >> On 15/10/2009, at 12:47 AM, Gabriel Roldan wrote: >> >>> I didn't get the patch, nor is it on my spam quarantine folder. But I >>> did get you email saying you applied the visitor right in the WFS >>> strategy object and it didn't work neither. Is that what you mean? >>> >>> Gabriel >>> Jody Garnett wrote: >>>> I am afraid "clone" may be around? >>>> I think I sent you a second patch in an earlier email? In anycase I >>>> did the patch on a work machine and cannot fetch it for you now. >>>> Jody >>>> On 15/10/2009, at 12:32 AM, Gabriel Roldan wrote: >>>>> Strange, the only reference to FastBBOX I found is in >>>>> StreamingRenderer.createBBoxFilters, and it's a straight >>>>> instantiation... >>>>> gonna try and update my udig dev env, keep you posted. >>>>> >>>>> Gabriel >>>>> Jody Garnett wrote: >>>>>> Hi again; >>>>>> So I did try the patch; and also tried applying it right before >>>>>> the strategy call - basically the duplicating feature visitor >>>>>> creates a FastBBOX out the other side (at least when I checked in >>>>>> the debugger) so the patch did not work for me. >>>>>> Jody >>>>>> On 14/10/2009, at 3:04 AM, Gabriel Roldan wrote: >>>>>>> Hi Jody, >>> >> > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > > > ------------------------------------------------------------------------ > > _______________________________________________ > Geotools-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/geotools-devel -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
aaime
|
Gabriel Roldan ha scritto:
> I know why it doesn't work, FastBBOX is tricky, it defeats the purpose > of DuplicatingFilterVisitor: > > public Object accept(FilterVisitor visitor, Object context) { > Object result = visitor.visit(this, context); > if(!(result instanceof BBOX)) > return result; > > BBOX clone = (BBOX) result; > if(clone.getExpression1().equals(getExpression1()) && > clone.getExpression2().equals(getExpression2())) > return new FastBBOX(property, envelope); > > return result; > } It does not defeat the purpose at all imho. A duplicate of a FastBbox is another FastBBOX. We're asked to copy, not to transform Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
aaime
|
In reply to this post
by Gabriel Roldan
Gabriel Roldan ha scritto:
> I know why it doesn't work, FastBBOX is tricky, it defeats the purpose > of DuplicatingFilterVisitor: > > public Object accept(FilterVisitor visitor, Object context) { > Object result = visitor.visit(this, context); > if(!(result instanceof BBOX)) > return result; > > BBOX clone = (BBOX) result; > if(clone.getExpression1().equals(getExpression1()) && > clone.getExpression2().equals(getExpression2())) > return new FastBBOX(property, envelope); > > return result; > } > > gonna see what else could be done Btw, I've suggested in IRC to make FastBBOX implement the deprecated interfaces if it's necessary. It's a package private class that is supposed to be a drop in replacement for a BBOX filter and well, it is for all modules that use the new filter interfaces, but not for the old ones. But we can make it implement the old ones as well Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Gabriel Roldan
|
In reply to this post
by aaime
Andrea Aime wrote:
> Gabriel Roldan ha scritto: >> I know why it doesn't work, FastBBOX is tricky, it defeats the purpose >> of DuplicatingFilterVisitor: >> >> public Object accept(FilterVisitor visitor, Object context) { >> Object result = visitor.visit(this, context); >> if(!(result instanceof BBOX)) >> return result; >> >> BBOX clone = (BBOX) result; >> if(clone.getExpression1().equals(getExpression1()) && >> clone.getExpression2().equals(getExpression2())) >> return new FastBBOX(property, envelope); >> >> return result; >> } > > It does not defeat the purpose at all imho. > A duplicate of a FastBbox is another FastBBOX. > We're asked to copy, not to transform created by the FilterFactory set in the DuplicatingFilterVisitor, if one wants the equivalent filter with an specific implementation. Anyways, I'm going to hack on WFSDataStore. Cheers, Gabriel > > Cheers > Andrea > > -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Gabriel Roldan
|
In reply to this post
by aaime
Andrea Aime wrote:
> Gabriel Roldan ha scritto: >> I know why it doesn't work, FastBBOX is tricky, it defeats the purpose >> of DuplicatingFilterVisitor: >> >> public Object accept(FilterVisitor visitor, Object context) { >> Object result = visitor.visit(this, context); >> if(!(result instanceof BBOX)) >> return result; >> >> BBOX clone = (BBOX) result; >> if(clone.getExpression1().equals(getExpression1()) && >> clone.getExpression2().equals(getExpression2())) >> return new FastBBOX(property, envelope); >> >> return result; >> } >> >> gonna see what else could be done > > Btw, I've suggested in IRC to make FastBBOX implement the deprecated > interfaces if it's necessary. > It's a package private class that is supposed to be a drop in > replacement for a BBOX filter and well, it is for all modules that > use the new filter interfaces, but not for the old ones. > But we can make it implement the old ones as well module that needs to be ported to the new filter interfaces rather than polluting new stuff with the old ones. What do you think? Gabriel > > Cheers > Andrea > -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
aaime
|
In reply to this post
by Gabriel Roldan
Gabriel Roldan ha scritto:
> Andrea Aime wrote: >> Gabriel Roldan ha scritto: >>> I know why it doesn't work, FastBBOX is tricky, it defeats the >>> purpose of DuplicatingFilterVisitor: >>> >>> public Object accept(FilterVisitor visitor, Object context) { >>> Object result = visitor.visit(this, context); >>> if(!(result instanceof BBOX)) >>> return result; >>> >>> BBOX clone = (BBOX) result; >>> if(clone.getExpression1().equals(getExpression1()) && >>> clone.getExpression2().equals(getExpression2())) >>> return new FastBBOX(property, envelope); >>> >>> return result; >>> } >> >> It does not defeat the purpose at all imho. >> A duplicate of a FastBbox is another FastBBOX. >> We're asked to copy, not to transform > I think it does because one would expect the returning filter to be > created by the FilterFactory set in the DuplicatingFilterVisitor, if one > wants the equivalent filter with an specific implementation. Anyways, > I'm going to hack on WFSDataStore. Hmm... duplicating that way would break the very reason the FastBBOX has been created for: avoiding full topologic operations. Unfortunately just creating it in the renderer does not help, there are various copies on the road to actual data access... The better way would be to have the library recognize loose bbox as a legitimate use case, but that required more time than I had, was planning to start pushing on that after FOSS4G Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
Gabriel Roldan
|
Andrea Aime wrote:
> Gabriel Roldan ha scritto: >> Andrea Aime wrote: >>> Gabriel Roldan ha scritto: >>>> I know why it doesn't work, FastBBOX is tricky, it defeats the >>>> purpose of DuplicatingFilterVisitor: >>>> >>>> public Object accept(FilterVisitor visitor, Object context) { >>>> Object result = visitor.visit(this, context); >>>> if(!(result instanceof BBOX)) >>>> return result; >>>> >>>> BBOX clone = (BBOX) result; >>>> if(clone.getExpression1().equals(getExpression1()) && >>>> clone.getExpression2().equals(getExpression2())) >>>> return new FastBBOX(property, envelope); >>>> >>>> return result; >>>> } >>> >>> It does not defeat the purpose at all imho. >>> A duplicate of a FastBbox is another FastBBOX. >>> We're asked to copy, not to transform >> I think it does because one would expect the returning filter to be >> created by the FilterFactory set in the DuplicatingFilterVisitor, if >> one wants the equivalent filter with an specific implementation. >> Anyways, I'm going to hack on WFSDataStore. > > Hmm... duplicating that way would break the very reason the FastBBOX > has been created for: avoiding full topologic operations. > Unfortunately just creating it in the renderer does not help, > there are various copies on the road to actual data access... > > The better way would be to have the library recognize loose bbox > as a legitimate use case, but that required more time than I had, > was planning to start pushing on that after FOSS4G > > Cheers > Andrea > > -- Gabriel Roldan OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
|
aaime
|
Gabriel Roldan ha scritto:
> Andrea Aime wrote: >> Gabriel Roldan ha scritto: >>> Andrea Aime wrote: >>>> Gabriel Roldan ha scritto: >>>>> I know why it doesn't work, FastBBOX is tricky, it defeats the >>>>> purpose of DuplicatingFilterVisitor: >>>>> >>>>> public Object accept(FilterVisitor visitor, Object context) { >>>>> Object result = visitor.visit(this, context); >>>>> if(!(result instanceof BBOX)) >>>>> return result; >>>>> >>>>> BBOX clone = (BBOX) result; >>>>> if(clone.getExpression1().equals(getExpression1()) && >>>>> clone.getExpression2().equals(getExpression2())) >>>>> return new FastBBOX(property, envelope); >>>>> >>>>> return result; >>>>> } >>>> >>>> It does not defeat the purpose at all imho. >>>> A duplicate of a FastBbox is another FastBBOX. >>>> We're asked to copy, not to transform >>> I think it does because one would expect the returning filter to be >>> created by the FilterFactory set in the DuplicatingFilterVisitor, if >>> one wants the equivalent filter with an specific implementation. >>> Anyways, I'm going to hack on WFSDataStore. >> >> Hmm... duplicating that way would break the very reason the FastBBOX >> has been created for: avoiding full topologic operations. >> Unfortunately just creating it in the renderer does not help, >> there are various copies on the road to actual data access... >> >> The better way would be to have the library recognize loose bbox >> as a legitimate use case, but that required more time than I had, >> was planning to start pushing on that after FOSS4G > understood and agreed, hence I prefer a hack on WFSDataStore. Agreed? Works for me :) Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geotools-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/geotools-devel |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |