Error in API Documentation? GeodatabaseFeatureTable.queryRelated

1011
2
Jump to solution
04-24-2017 04:25 PM
ForrestKaye
New Contributor III

I am attempting to switch from a GeodatabaseFeatureTable.queryFeatures(...) to .queryRelated method as I thought it would increase performance.  However, I cannot seem to work with the Future<> result in the same way.  I have followed the API documentation exactly but I get a compile error with the sample code.  So unless I am missing something there seems to be an issue with the documentation.  Any other attempts to work with the FeatureResult have not worked.

Here is a picture of what I'm seeing when I use the sample provided in the API documentation

Java Code

As far as I can tell everything is in order with both methods.

I am using the 10.2.9 Runtime Library.  

As a side note the reason I am needing to change original implementation of my table query was a strange error that was only occurring occasionally when running multiple table queries on an asyc task.  The error was: 

A/libc: Fatal signal 11 (SIGSEGV) at 0x00b52a0b (code=1), thread 23436

Thanks,

0 Kudos
1 Solution

Accepted Solutions
ForrestKaye
New Contributor III

No unfortunately that doesn't change anything.  It does not know how to handle entry.getValue().

After a bit more playing around I was able to solve it using this methodology:

               Map<Long, FeatureResult> result = resultFutureRelatedQeury.get();
               for (Map.Entry<Long, FeatureResult> entry : result.entrySet()) {
                    long id = entry.getKey(); // parcel id
                    Iterator<Object> features = entry.getValue().iterator();
                    while(features.hasNext()) {
                         Object element = features.next();
                         Feature feature = (Feature) element;
                    }
               }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

2 Replies
AlexanderNohe1
Occasional Contributor III

Hi Forrest Kaye‌,

Does this work for you instead:

 Map<Long, FeatureResult> result = resultFuture.get();
 for (Map.Entry<Long, FeatureResult> entry : result.entrySet()) {
   long id = entry.getKey(); // parcel id
   while (Object o : entry.getValue()) {
     Feature feature = (Feature) o; // building
     Map<String, Object> attrs = feature.getAttributes();
   }
 }

It looks like when this was originally written, that there was an assumption that FeatureResult would have been Future<FeatureResult>.  We can submit a documentation update but I just wanted confirmation first on whether not using the get method resolved your issue.

0 Kudos
ForrestKaye
New Contributor III

No unfortunately that doesn't change anything.  It does not know how to handle entry.getValue().

After a bit more playing around I was able to solve it using this methodology:

               Map<Long, FeatureResult> result = resultFutureRelatedQeury.get();
               for (Map.Entry<Long, FeatureResult> entry : result.entrySet()) {
                    long id = entry.getKey(); // parcel id
                    Iterator<Object> features = entry.getValue().iterator();
                    while(features.hasNext()) {
                         Object element = features.next();
                         Feature feature = (Feature) element;
                    }
               }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍