Select to view content in your preferred language

getFeature from geodatabaseFeatureTable

2003
1
06-17-2014 09:26 AM
forestknutsen1
MVP Regular Contributor
I know the object ID of (OBJECTID) of the feature I want from a local geodatabase on the sd card. I wish to pick it out and display

I have this in my on click for my search button...

try {
   searchFeature = geodatabaseFeatureTable.getFeature(2);
  } catch (TableException e1) {
   // TODO Auto-generated catch block e1.printStackTrace(); }

   Geometry searchFeatureGeometry = searchFeature.getGeometry();
   Graphic searchGraphic = new Graphic(searchFeatureGeometry, sfs);
   GraphicsLayer searchGraphicLayer = new GraphicsLayer();
   searchGraphicLayer.addGraphic(searchGraphic);
   mMapView.addLayer(searchGraphicLayer);
  }


when I pass getFeature(1) it works fine but when I pass getFeature(2) the output is null. What is wrong here?

Thanks so much for any help,

Forest
0 Kudos
1 Reply
forestknutsen1
MVP Regular Contributor
OK looks like there is nothing wrong with the code (whether it is the best way to do the job is a different question) but with my geodatabase. When it was made it looks like 2 of the 9 features in it were omitted somehow, because when I call geodatabaseFeatureTable.getNumberOfFeatures(); only 7 is returned. Also, when I pass 3 to getFeature() the expected polygon is returned. Is there a good why to look inside of a runtime geodatabase after it has been made, just to confirm that it is what one thinks it is?

Thanks,

Forest
0 Kudos