Hi,
Great analysis, it works when I change the attribute to something like "geom".
Any suggestions on how to build a xpath like feature since xpath is used in my
fiter object?
Many thanks,
...-H
Sent from my BlackBerry device on the Rogers Wireless Network
-----Original Message-----
From: Andrea Aime <[email protected]>
Sender: [email protected]
Date: Sat, 8 Dec 2012 17:09:37
To: Hoang Dam<[email protected]>
Cc: <[email protected]>
Subject: Re: [Geotools-gt2-users] filter.evaluate(feature) doesn't return
expected result
On Sat, Dec 8, 2012 at 6:30 AM, Hoang Dam <[email protected]> wrote:
> Hi list,
>
> I'm using geotool version 8.3 to use fes 2.0 filter for some geometry. My
> filter object works as expected and contains the correct information [
> aixm:timeSlice//aixm:ElevatedPoint dwithin LINESTRING (51.5 -0.5, 38.9
> -77), distance: 50.0 ]. Then I create a simple feature that has a Point
> using SimpleFeatureTypeBuilder & SimpleFeatureBuilder as followed:
>
> Object geometry = new GeometryFactory().createPoint(new
> Coordinate(38.9, -77))
>
> SimpleFeatureTypeBuilder builderType = new
> SimpleFeatureTypeBuilder();
> builderType.setName("Simple");
> builderType .setNamespaceURI("http://www.some.namespace");
> builderType .add(FEATURES_DEFAULT_GEOMETRY, Object.class);
> builderType .setDefaultGeometry(FEATURES_DEFAULT_GEOMETRY);
>
> SimpleFeatureBuilder builder = new
> SimpleFeatureBuilder(builderType.buildFeatureType());
> builder.add(geometry);
> SimpleFeature simpleFeature = builder.buildFeature("featureName");
>
> match = filter.evaluate(simpleFeature);
>
> I would expect match to be true since the point is on the linestring, but
> it returns false. What have I missed?
>
Can't say for sure, your example is incomplete, but I see you are using a
xpath to select
the attribute, as if it was a nested one, but simple features are flat,
they can't have nested attributes,
so the property evaluation probably returns null and makes the filter fail
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
-------------------------------------------------------
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users