Displaying differences for changeset
 
display as  

src/java/m/wqm/wqmsoilattributes/V1_0.java

@@ -31,13 +31,14 @@
 @Name("WQM-02: Soil Component Attributes (WQMSoilAttributes)")
 @Description("This service intersects area of analysis (AoA) geometry with SSURGO soil mapunit geometry, derives a list of distinct soil components for the AoA, and gets attributes from SSURGO tables required for computing nutrient and pesticide loss potentials.")
 @Path("m/wqmsoilattributes/1.0")
-@Polling(first = 10000, next = 2000)
+@Polling(first = 5000, next = 2000)
 
 public class V1_0 extends ModelDataService {
     
     //mapunit/ssurgo polygon intersect URI
     private final String SSURGO_INTERSECT_URI = "http://csip.engr.colostate.edu:8086/csip-erosion/d/soils/1.2";        
-
+    private final Double minimumPercentage = 0.05;
+    
     //Request
     private String aoaId;
     private JSONObject aoaGeometry;
@@ -102,11 +103,11 @@
                     query = "SELECT ssurgo.component.mukey, ssurgo.component.cokey, ssurgo.component.compname, ssurgo.component.comppct_r, ssurgo.component.hydgrp, "
                             + " ssurgo.component.slope_r, ssurgo.component.taxorder, ssurgo.chorizon.chkey, ssurgo.chorizon.om_r, ssurgo.chorizon.hzthk_r, "
                             + " ssurgo.chorizon.hzdept_r, ssurgo.chorizon.hzdepb_r, ssurgo.chorizon.kwfact, ssurgo.chorizon.kffact, ssurgo.chfrags.fragvol_r, ssurgo.chfrags.chfragskey FROM ssurgo.component "
-                            + " LEFT OUTER JOIN ssurgo.chorizon ON ssurgo.chorizon.cokey=ssurgo.component.cokey LEFT OUTER JOIN ssurgo.chfrags on ssurgo.chfrags.chkey=ssurgo.chorizon.chkey WHERE ssurgo.component.mukey='";
+                            + " LEFT OUTER JOIN ssurgo.chorizon ON ssurgo.chorizon.cokey=ssurgo.component.cokey LEFT OUTER JOIN ssurgo.chfrags on ssurgo.chfrags.chkey=ssurgo.chorizon.chkey WHERE ssurgo.component.mukey in ( '";
 
                     while (ite.hasNext()) {
                         if ( mapCount > 0 ){
-                            query += " OR ssurgo.component.mukey='" + ite.next().toString() + "' ";
+                            query += ", '" + ite.next().toString() + "' ";
                         }
                         else{
                             query += ite.next().toString() + "' ";
@@ -114,7 +115,7 @@
 
                         mapCount++;
                     }
-                    query += "AND ssurgo.component.comppct_r IS NOT NULL ORDER BY ssurgo.component.mukey, ssurgo.component.cokey, ssurgo.chorizon.chkey, ssurgo.chorizon.hzdept_r;";
+                    query += "AND ssurgo.component.comppct_r IS NOT NULL ORDER BY ssurgo.component.mukey, ssurgo.component.cokey, ssurgo.chorizon.chkey, ssurgo.chorizon.hzdept_r;";
                     resultSet = this.statement.executeQuery( query );
                     while( resultSet.next() ){
                         V1_0.Component tComponent;
@@ -160,9 +161,9 @@
                     }
                     
                     int componentsRemaining = 0;
-                    //Remove components having less than 10% of total area "totalAreas" here.                
+                    //Remove components having less than minimumPercentage of total area "totalAreas" here.                
                     for( V1_0.Component component : this.componentList ){
-                        if ( (component.getArea() / totalAreas ) < 0.10 ){
+                        if ( (component.getArea() / totalAreas ) < this.minimumPercentage ){
                             component.setDeleted(true);
                         }
                         else{