I'm not sure if Hal was working on the SelectionLab of the Style tutorial
(http://docs.geotools.org/latest/userguide/tutorial/map/style.html) or not, but
the createStyle method
(http://docs.geotools.org/latest/userguide/tutorial/map/style.html#what-features-did-the-user-click-on)
contains the following line which is in direct conflict with what Andrea said.
Filter filter = ff.intersects(ff.property(geometryAttributeName),
ff.literal(bbox));
Updating my tutorial to use the following appears to resolve the null pointer
exception
Filter filter = ff.intersects(ff.property(geometryAttributeName),
ff.literal(JTS.toGeometry(bbox)));
-Duane
From: Hal Mirsky [mailto:[email protected]]
Sent: Thursday, September 12, 2013 7:25 PM
To: 'Andrea Aime'; 'Jody Garnett'
Cc: 'geotools users'
Subject: Re: [Geotools-gt2-users] null pointer expection
inShapefileFeatureSource
Thanks very much Andrea. That was the key! I used JTS to convert the
ReferencedEnvelope into a JTS Polygon, apply the proper transform and the
intersect filter now works.
Hal
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Andrea Aime
Sent: Thursday, September 12, 2013 8:42 AM
To: Hal Mirsky; Jody Garnett
Cc: geotools users
Subject: Re: [Geotools-gt2-users] null pointer expection in
ShapefileFeatureSource
On Thu, Sep 12, 2013 at 5:26 PM, Hal Mirsky
<[email protected]<mailto:[email protected]>> wrote:
Hello,
I found that if I changed the filter from
filter = ff2.intersects(ff2.property(poigeometryAttributeName),
ff2.literal(bbox));
to
filter = ff2.bbox(ff2.property(poigeometryAttributeName), bbox);
No exception is raised and the correct set of features is returned.
Hum...a second here. What the type of bbox?
Is it a Envelope of some kind?
If so the first filter does not make sense (at least not to me), the second
operand of
a intersects filter should be a JTS geometry, not an Envelope.
The old data store was probably lenient towards this use case which, personally,
I've never seen in practice.
Jody, do you know if we ever supported spatial filters against envelope objects?
Cheers
Andrea
--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users