Browse Source

법정동 코드 리턴 유틸 - 특정 depth까지만 추출하는 기능 추가 ( 광역시 / 시군구 / 읍면동 / 리 )

pull/12/head
박재우 11 months ago
parent
commit
efdf974e24
  1. 28
      pav-server/src/main/java/com/palnet/comn/utils/FlightUtils.java

28
pav-server/src/main/java/com/palnet/comn/utils/FlightUtils.java

@ -158,6 +158,7 @@ public class FlightUtils {
return result;
}
//좌표의 읍면동 , 리 등 가장 세분화된 법정동 코드를 리턴
public static JSONObject getCoordinateGis(Coordinate coordinate) throws IOException, ParseException {
String baseFileName = "all_location.geojson";
@ -181,6 +182,33 @@ public class FlightUtils {
}
}
//depth를 통해 좌표의 특정 구간(2 : 광역시, 5 : 시군구, 8 : 읍면동 / 리)에 해당하는 정보를 가져옴
public static JSONObject getCoordinateGis(Coordinate coordinate, int depth) throws IOException, ParseException {
String baseFileName = "all_location.geojson";
JSONObject obj = new JSONObject();
log.info("path >>>>>> {}", basePath);
String path = basePath;
while(true) {
File file = new File(path+baseFileName);
if(!file.exists()) return obj;
obj = parseGeoJson(path+baseFileName, coordinate);
if(obj.get("CD").toString().length() >= depth) return obj;
path += obj.get("CD")+"/";
}
}
public static JSONObject parseGeoJson(String path, Coordinate coordinate) throws IOException, ParseException {
GeometryFactory geometryFactory = new GeometryFactory();

Loading…
Cancel
Save