|
@@ -19,19 +19,19 @@ public class GeoJsonIntersector {
|
|
|
// run("香花桥街道","香花桥居委会,朝阳村,金星村,都汇华庭居委会,盈中村,石西村,杨元村,七汇村,袁家村,郏一村,青山居委会,金巷居委会","香花桥小学");
|
|
|
// run("夏阳街道", "南门塔湾,大生桥,李腰泾,王仙村,城南村,塘郁村,枫泾村,太来村,新阳村,金家村,夏阳村,丝绸新村,志诚上和里", "豫才中学");
|
|
|
// run("盈浦街道", "南横村", "思源中学");
|
|
|
- run("香花桥街道",null,"香花桥街道");
|
|
|
+ run("香花桥街道","","香花桥街道");
|
|
|
|
|
|
}
|
|
|
|
|
|
public static void run(String jdNameStr, String czNameStr, String fileName) throws Exception {
|
|
|
List<String> jdNameList = new ArrayList<>(Arrays.asList(jdNameStr.split(",")));
|
|
|
List<String> nameList = new ArrayList<>();
|
|
|
- if(czNameStr != null){
|
|
|
+ if(czNameStr != null && !czNameStr.isEmpty()){
|
|
|
nameList = new ArrayList<>(Arrays.asList(czNameStr.split(",")));
|
|
|
System.out.println("******需要匹配的村名个数:" + nameList.size());
|
|
|
}
|
|
|
|
|
|
- JSONObject processingGeoJson = readGeoJson("src/main/resources/geojson/qp_cunju_2024.geojson");
|
|
|
+ JSONObject processingGeoJson = readGeoJson("src/main/resources/geojson/qp_cunju.geojson");
|
|
|
JSONArray features = (JSONArray) processingGeoJson.get("features");
|
|
|
JSONArray newFeatures = new JSONArray();
|
|
|
for (Object feature : features) {
|
|
@@ -39,7 +39,7 @@ public class GeoJsonIntersector {
|
|
|
String jiezhen = item.getJSONObject("properties").getString("jz");
|
|
|
String cunName = item.getJSONObject("properties").getString("cjname");
|
|
|
if (jdNameList.contains(jiezhen)) {
|
|
|
- if(czNameStr == null){
|
|
|
+ if(czNameStr == null || czNameStr.isEmpty()){
|
|
|
newFeatures.add(feature);
|
|
|
}else if(nameList.contains(cunName)){
|
|
|
newFeatures.add(feature);
|