Administrator 2 年之前
父節點
當前提交
2bdfd4d441

+ 3 - 3
src/main/java/com/sysu/admin/controller/aland/CropAreaStat.java

@@ -20,9 +20,9 @@ public class CropAreaStat {
     private String color;
     private Integer count = 0;
 
-    public static  String[] cropTypes = {"corn","rice","other"};
-    public static  String[] name2s = {"玉米","水稻","其他"};
-    public static  String[] colors = {"#CD0000","#228B22","#FFFF00"};
+    public static  String[] cropTypes = {"corn","rice","other","guoshu"};
+    public static  String[] name2s = {"玉米","水稻","其他","果树"};
+    public static  String[] colors = {"#CD0000","#228B22","#B4B9B8","#FFBD01"};
 
     public static Integer getCropTypeIndex(String cropType){
         for(int i=0;i<cropTypes.length;i++){

+ 1 - 1
src/main/java/com/sysu/admin/controller/aland/LandAreaStat.java

@@ -23,7 +23,7 @@ public class LandAreaStat {
      * 0其它 1水田  2水浇地  3旱地  4果园
      */
     static  String[] name2s = {"其他","水田","水浇地","旱地","果园"};
-    static  String[] colors = {"#696969","#1E90FF","#8B658B","#CD0000","#FFFF00"};
+    static  String[] colors = {"#696969","#228B22","#58AB28","#EEB554","#D365A1"};
 
     public static String castName(Integer id){
         if(id != null){

+ 2 - 4
src/main/java/com/sysu/admin/utils/shape/ShapeReader.java

@@ -103,9 +103,6 @@ public class ShapeReader {
             SimpleFeature feature = itertor.next();
 
             Map<String, Object> map = new HashMap<>();
-            addValue(map, feature, "InPoly_FID");
-            System.out.println();
-            System.out.println(map.get("inpoly_fid"));
             addValue(map, feature, "Area");
             addValue(map, feature, "SimPgnFlag");
             addValue(map, feature, "TOC");
@@ -121,8 +118,9 @@ public class ShapeReader {
             addValue(map, feature, "area_ha");
             addValue(map, feature, "value");
             addValue(map, feature, "intensity");
-            addValue(map, feature, "MAJORITY");
             addValue(map, feature, "ParcelType");
+            map.put("district_code","440882");
+            map.put("town_id",file.getName().indexOf("nanxing") > -1 ? "143" : "151");
             Geometry geometry = (Geometry)feature.getDefaultGeometry();
             for(Coordinate coordinate : geometry.getCoordinates()){
                 Double[] res = GeoCastUtil.mactorToLonlat(new Double[]{coordinate.getX(), coordinate.getY()});

+ 7 - 7
src/test/java/com/sysu/admin/utils/shape/postgis/PostGisUtilTest.java

@@ -135,7 +135,7 @@ public class PostGisUtilTest {
                 List<Map<String,Object>> list = ShapeReader.getShapeFileLeizhou(shp);
                 System.out.println("数据准备:");
                 System.out.println(list.size());
-                getInsertSqlsLeizhou(fileWriter, "leizhou_parcel_out0210", list);
+                getInsertSqlsLeizhou(fileWriter, list);
             }
 
             fileWriter.flush();
@@ -146,15 +146,15 @@ public class PostGisUtilTest {
     }
 
     @SneakyThrows
-    public void getInsertSqlsLeizhou(FileWriter fileWriter,String typeName, List<Map<String, Object>> list){
+    public void getInsertSqlsLeizhou(FileWriter fileWriter, List<Map<String, Object>> list){
         int i=0;
         int c = 100;
         while(i < list.size()) {
             if(i % c == 0) {
-                fileWriter.append("insert into leizhou_land (id,area,simpgnflag,toc,quxian,shengdao,hupo,gdp_pop,slope,aspect,name,id_card,crop_type,area_ha,value,intensity,majority,parcel_type,geom) values");
+                fileWriter.append("insert into leizhou_land (area,simpgnflag,toc,quxian,shengdao,hupo,gdp_pop,slope,aspect,name,id_card,crop_type,value,intensity,parcel_type,district_code,town_id,geom) values");
             }
+            fileWriter.append("(");
             Map<String, Object> map = list.get(i);
-            fileWriter.append(" ('"+((Double)map.get("inpoly_fid")).intValue()+"',");
             fileWriter.append("'"+map.get("area")+"',");
             fileWriter.append("'"+map.get("simpgnflag")+"',");
             fileWriter.append("'"+map.get("toc")+"',");
@@ -167,11 +167,11 @@ public class PostGisUtilTest {
             fileWriter.append("'"+map.get("name")+"',");
             fileWriter.append("'"+map.get("id_card")+"',");
             fileWriter.append("'"+map.get("crop_type")+"',");
-            fileWriter.append("'"+map.get("area_ha")+"',");
             fileWriter.append("'"+map.get("value")+"',");
             fileWriter.append("'"+((Double)map.get("intensity")).intValue()+"',");
-            fileWriter.append("'"+map.get("majority")+"',");
-            fileWriter.append("'"+map.get("parceltype")+"',");
+            fileWriter.append("'"+Double.valueOf(map.get("parceltype").toString()).intValue()+"',");
+            fileWriter.append("'"+map.get("district_code")+"',");
+            fileWriter.append("'"+map.get("town_id")+"',");
             fileWriter.append("st_geomfromtext('");
             fileWriter.append(map.get("geom").toString());
             fileWriter.append("',4326))");