Displaying differences for changeset
 
display as  

src/java/m/rse/cfactor/utils/PGTools.java

@@ -393,13 +393,12 @@
         String gdal = Config.getString("gdal.deployment",RSE_DEPLOYMENT_LINUX);
         String gdalwinpath = Config.getString("gdalwinpath","C:\\Program Files\\GDAL\\");
 
-        // linux based WEPS
     //pc.exe = 
     Binaries.unpackResourceAbsolute("/us_cvalues_topo2ras_masked.tfw", dataDir + "us_cvalues_topo2ras_masked.tfw").toString();
     String tifptr = Binaries.unpackResourceAbsolute("/us_cvalues_topo2ras_masked.tif", dataDir + "us_cvalues_topo2ras_masked.tif").toString();
     Binaries.unpackResourceAbsolute("/us_cvalues_topo2ras_masked.tif.aux.xml", dataDir + "us_cvalues_topo2ras_masked.tif.aux.xml").toString();
     logger.info("geotiff=" + tifptr);
-        
+                
         // Extract GDAL Library for Windows
         //
         if (gdal.equals(Const.RSE_DEPLOYMENT_WINDOWS))
@@ -445,10 +444,13 @@
         }
         
         // to do
+        // linux based WEPS assumes gdal is already installed
         // optionally we might bundle the GDAL files for Linux here as well
 
         //pc.exe = (gdal.equals(Const.RSE_DEPLOYMENT_WINDOWS) ? gdalwinpath : "") + "gdallocationinfo";
+        logger.info("gdal is equal to=" + gdal);
         pc.exe = (gdal.equals(Const.RSE_DEPLOYMENT_WINDOWS) ? dataDir : "") + "gdallocationinfo";
+        logger.info(" the pc.exe is=" + pc.exe);
     pc.args = new String[]{tifptr, slon, slat, "-wgs84"};
     File workDir = workspacedirectory;
     String sessionWorkDir = workDir.toString();
@@ -460,11 +462,11 @@
     logger.info("exe=" + pc.exe);
     String output[] = pc.stdout.split("\\r?\\n");
     // cvalue appears on last line of output
-//        for (int i=0; i<output.length; i++)
-//            LOG.info("i=" +i + " str=" + output[i]);
+        //for (int i=0; i<output.length; i++)
+        //    logger.info("i=" +i + " str=" + output[i]);
     String val[] = output[output.length - 1].split(" ");
-//        for (int i=0; i<val.length; i++)
-//            LOG.info("i=" +i + " str=" + val[i]);
+        //for (int i=0; i<val.length; i++)
+        //    logger.info("i=" +i + " str=" + val[i]);
     // c value is in the last position (col) of the last line  
     c_fact = Double.parseDouble(val[val.length - 1]);
 

src/java/m/rse/wepot/V1_0.java

@@ -110,7 +110,10 @@
 //TODO:  Call raster layer intersect code here ( to be determined by Wes )
                     LOG.info("THE POLYGON AS WE KNOW IT IS=" + this.polygonData.toWKT());
                     String cfactor_polygon  = "geometry::STPolyFromText(" + this.polygonData.toWKT() + ",4326)";
+                    LOG.info("getting centroid for polygon now");
                     PGTools.Centroid centroid = PGTools.getCentroid(cfactor_polygon);
+                    LOG.info("About to get C Factor Raster value for lat=" + centroid.lat + " long=" + centroid.lon + " ");
+                           
                     this.aoa_cfactor = PGTools.getCFactorRaster(centroid.lat, centroid.lon, getWorkspaceDir());
             //this.aoa_cfactor = Const.UNKNOWN_CFACTOR;  //  Change to the result of the function call to be written
                 

src/java/m/rse/wepot/V1_1.java

@@ -97,9 +97,12 @@
 
             LOG.info("THE POLYGON AS WE KNOW IT IS=" + this.polygonData.toWKT());
             String cfactor_polygon = "geometry::STPolyFromText(" + this.polygonData.toWKT() + ",4326)";
+                    LOG.info("getting centroid for polygon now");
             PGTools.Centroid centroid = PGTools.getCentroid(cfactor_polygon);
-            //this.aoa_cfactor = PGTools.getCFactorRaster(centroid.lat, centroid.lon, getWorkspaceDir());
-            this.aoa_cfactor = Const.UNKNOWN_CFACTOR;  //  Change to the result of the function call to be written
+                    LOG.info("About to get C Factor Raster value for lat=" + centroid.lat + " long=" + centroid.lon + " ");
+            this.aoa_cfactor = PGTools.getCFactorRaster(centroid.lat, centroid.lon, getWorkspaceDir());
+                    
+            //this.aoa_cfactor = Const.UNKNOWN_CFACTOR;  //  Change to the result of the function call to be written
 
             //Call SSURGO gemoetry intersect code here ( ssurgo.soilmu_a table )
             //Call SSURGO component lookups here ( ssurgo.component table )            
@@ -116,9 +119,9 @@
         this.error_msg += "SQL exception getting cfactor:  " + se.getMessage();
     } catch (ServiceException sx) {
         this.error_msg += "Service exception getting cfactor:  " + sx.getMessage();
-    } //catch (IOException ioe) {
-      //  this.error_msg += "IO Exception getting cFactor value from raster geotiff layer:  " + ioe.getMessage();
-    //}
+    } catch (IOException ioe) {
+        this.error_msg += "IO Exception getting cFactor value from raster geotiff layer:  " + ioe.getMessage();
+    }
 
     return (this.error_msg.isEmpty() ? EXEC_OK : this.error_msg);
     }