@@ -503,10 +503,15 @@ |
// lat + ")' ), geometry)) AS s WHERE m.musym = s.musym LIMIT 1;"); |
} |
|
+ |
+ // |
+ // fix me |
+ // |
+ // added string matching to fix a problem which requires us to regenerate r2 soils |
public FileQryResult findSoilsByCokey(String cokey, double lon) throws SQLException { |
return find ("SELECT distinct m.musym, r2_path, r2_name FROM soil_geom AS g, map_soils AS m " + |
"WHERE m.cokey='" + cokey + "' " + |
- "AND g.mukey = m.mukey limit 1; ", lon); |
+ "AND g.mukey = m.mukey and m.r2_name like '%' || m.compname || '%' limit 1; ", lon); |
} |
|
// To calculate area in acres, we use the st_transform function to transform the intersection polygon into |
@@ -549,6 +554,8 @@ |
_polygon = polygon; |
poly_longitude = -90.111; |
} |
+ // added a fix "and m.r2_name like '%' || m.compname || '%'" to the end of this query because |
+ // soils have duplicate records presently, and need to be regenerated... |
return findPolygonsWithSand ("SELECT m.co_fips, m.musym, m.mukey, r2_path, r2_name, m.muname, " + |
"m.compname, m.kffact, m.tfact, m.slope_r, m.cokey, m.sandtotal_r, " + |
"st_area(st_intersection(" + _polygon + |
@@ -562,7 +569,7 @@ |
"AND g.mukey = m.mukey " + |
"and st_isvalid(geometry)='t' " + |
"and st_isvalid(" + _polygon + |
- ")='t';", poly_longitude); |
+ ")='t' and m.r2_name like '%' || m.compname || '%';", poly_longitude); |
} |
|
|
@@ -591,7 +598,7 @@ |
"AND g.mukey = m.mukey " + |
"and st_isvalid(geometry)='t' " + |
"and st_isvalid(" + _polygon + |
- ")='t';", poly_longitude); |
+ ")='t'", poly_longitude); |
} |
|
|