Hello,
I was wondering if there were any good examples that would show me how to execute a QueryFeaturesAsync call on a FeatureTable using a SpatialRelationship of Within. I've got some code wired up but it doesn't seem to be returning any results, when I know there should be.
Here's the code I'm currently using. An exception is getting caught - no elements in this sequence when I try to get the First item from the query results.
Thanks,
Mike...
Are you sure it's a Within and not a Contains. Personally I always play around with those spatial relationships because they never seem to work like I think they should.
Also in general I think using FirstOrDefault and checking for null is a cleaner approach, as opposed to capturing an exception.
Yeah, I agree with Joe, you might want to experiment with some other relationships just to see what you get. Maybe it's a spatial reference issue? Are you sure the geometry you're querying with is coincident with the input features? Perhaps, as a quick test, you could try zooming to the extent of the envelope used for the query.
Thanks a lot to all of you for the comments. It ended up being the Contains (vs. Within). Once I started using Contains, I got the results I expected.
Thanks again,
Mike Hamsa
Chief Technology Officer - GeoSpatial Innovations, Inc.
P: 512-982-6735
Also make sure that the SpatialReference of your envelope matches that of your layer.