Displaying differences for changeset
 
display as  

src/java/m/crp1/erosion/V3_0.java

@@ -21,6 +21,8 @@
 import csip.api.server.ServiceException;
 import csip.utils.JSONUtils;
 import csip.utils.Parallel;
+import data.interpretors.IFCFile;
+import data.interpretors.SOLFile;
 import data.interpretors.SlopeSteepness;
 import gisobjects.GISObject;
 import static gisobjects.GISObject.DEFAULT_ASSUMED_SRID;
@@ -131,6 +133,7 @@
   protected double legacyWindErosion;
   protected double legacyWaterErosion;
   protected String stateFips, countyFips;
+  protected String stateAbbr, countyName;  
 
   /**
    *
@@ -423,7 +426,7 @@
   protected void getBasicErosionVariables() throws ServiceException, SQLException {
     //  Find State and County FIPS using NRT
     try (Connection conn = resources().getJDBC(NRT_DB); Statement stmnt = conn.createStatement();) {
-      String query = "SELECT state_code, county_code FROM d_state_county "
+      String query = "SELECT state_code, state_abbr, county_code, county_name FROM d_state_county "
           + " WHERE state_county_geometry.STContains( geometry::STGeomFromText('POINT(" + longitude + " " + latitude + ")', 4326)) = 1 "
           + " AND state_county_geometry.STSrid is not NULL"
           + " AND state_county_type='C';";
@@ -431,6 +434,8 @@
         if (result.next()) {
           stateFips = result.getString("state_code");
           countyFips = result.getString("county_code");
+          stateAbbr = result.getString("state_abbr");
+          countyName = result.getString("county_name");
         } else {
           throw new ServiceException("No county located in NRT State County query for that point: POINT( " + longitude + " " + latitude + " )");
         }
@@ -499,6 +504,8 @@
     DecimalFormat df = new DecimalFormat("#.##");
     DecimalFormat t_df = new DecimalFormat("#.#");
 
+    results().put("state", stateAbbr);
+    results().put("county", countyName);
     results().put("aoi_area", Double.parseDouble(df.format(aoiArea)),
         "Area of the input geometry", "ac");
     results().put("shape_adjusted", aoiShape.hasChanged(),
@@ -546,7 +553,20 @@
     if (detailedOutput) {
       JSONArray topThreeDetails = new JSONArray();
       for (SignificantSoil tSoil : topThree) {
-        topThreeDetails.put(tSoil.toJSON());
+        JSONArray soilData = tSoil.toJSON();
+
+        IFCFile ifc = new IFCFile(tSoil.mapUnit.toIfc(tSoil.component.cokey()));
+        SOLFile sol = new SOLFile(tSoil.component.toSol());
+        soilData.put(JSONUtils.data("sol_wepp_surface_sand",sol.sand[0]));
+        soilData.put(JSONUtils.data("sol_wepp_surface_clay",sol.clay[0]));     
+        soilData.put(JSONUtils.data("sol_wepp_surface_cec",sol.cec[0]));            
+        
+        soilData.put(JSONUtils.data("ifc_weps_surface_wilting_point",ifc.wiltingPointSWC[0]));
+        soilData.put(JSONUtils.data("ifc_weps_surface_sand",ifc.fractionSand[0]));
+        soilData.put(JSONUtils.data("ifc_weps_surface_silt",ifc.fractionSilt[0]));
+        soilData.put(JSONUtils.data("ifc_weps_surface_clay",ifc.fractionClay[0]));        
+                
+        topThreeDetails.put(soilData);        
       }
       if (aoiShape.hasChanged()) {
         results().put("changed_or_corrected_input_shape", ((aoiShape.hasChanged()) ? aoiShape.toJSON() : "NONE"),