mysony

setSpatialRelationship(SpatialRelationship.WITHIN) not true work

Discussion created by mysony on Feb 7, 2014
Hi, I want to select by location on two feature layer and use spatial relationship by within argument but my program selects another feature and within not working correctly my code in here and result are attached  please help me

[ATTACH=CONFIG]31247[/ATTACH]

mapAssistance as=new mapAssistance();
 as.initialize(gdb);
 as.setFeatureTbl("region");//add region layer infeature table
 QueryParameters params=new QueryParameters();  
 EditText etregionA=(EditText) findViewById(R.id.editTextregionA);
 EditText etregionB=(EditText) findViewById(R.id.editTextregionB);
 EditText etregionC=(EditText) findViewById(R.id.editTextregionC);
 EditText etregionD=(EditText) findViewById(R.id.editTextregionD);
 params.setWhere("zoneA="+etregionA.getText().toString());
 params.setReturnGeometry(true);
 Future<FeatureResult> area= as.queryFeatures(params,false);
 try {
  for (Object result : area.get()) {     
      Feature featurearea = (Feature) result;
      if( etregionB.getText().toString().trim().length() == 0)
              {
       this.zoomToGeometry(featurearea.getGeometry());
       return;
       }
      Polygon poly=new Polygon();
      poly=(Polygon) featurearea.getGeometry();//error in here
      params=new QueryParameters();
      params.setReturnGeometry(true);
      params.setGeometry(poly);
      params.setInSpatialReference(featurearea.getSpatialReference());      
      params.setWhere("ZoneB="+etregionB.getText().toString());
      params.setSpatialRelationship(SpatialRelationship.WITHIN);
      as=new mapAssistance();
    as.initialize(gdb);
      as.setFeatureTbl("section");
      Future<FeatureResult> sec= as.queryFeatures(params,false);    
       for (Object result2 : sec.get()) {     
         Feature featuresec = (Feature) result2;
         if( etblock.getText().toString().trim().length() == 0)
          { 
          String rett=  featuresec.getAttributeValue("region").toStrin();
          if(rett !=null  ||rett!="")
          {           
          double ab= Double.parseDouble(rett);          
          double ac= Double.parseDouble((etregionA.getText().toString()));           
          if(ab==ac)
          {
           zoomToGeometry(featuresec.getGeometry());
           return;
          }
          }
        
          }
                           break;
     }

  return;
  }
 } catch (InterruptedException e) {

  e.printStackTrace();
 } catch (ExecutionException e) {

  e.printStackTrace();
 }  
}

Attachments

Outcomes