Browse Source

feat : geojson 읽어오는 방식 rollback

pull/18/head
qkr7828 8 months ago
parent
commit
051c2cbb0f
  1. 31
      pav-server/src/main/java/com/palnet/comn/utils/CoordUtils.java

31
pav-server/src/main/java/com/palnet/comn/utils/CoordUtils.java

@ -102,15 +102,17 @@ public class CoordUtils {
String path = basePath + coords + "/" + baseFileName;
try (InputStream inputStream = new ClassPathResource(path).getInputStream()) {
byte[] binaryData = FileCopyUtils.copyToByteArray(inputStream);
String content = new String(binaryData, "UTF-8");
try(InputStream inputStream = new ClassPathResource(path).getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8192)) {
JSONParser jsonParser = new JSONParser();
jsonObject = (JSONObject) jsonParser.parse(content);
} catch (Exception e) {
e.printStackTrace();
jsonObject = (JSONObject) jsonParser.parse(reader);
}catch(Exception e) {
e.getStackTrace();
}
return jsonObject;
}
@ -258,22 +260,25 @@ public class CoordUtils {
Point point = null;
try (InputStream inputStream = new ClassPathResource(path).getInputStream()) {
byte[] binaryData = FileCopyUtils.copyToByteArray(inputStream);
String content = new String(binaryData, "UTF-8");
try(InputStream inputStream = new ClassPathResource(path).getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8192)) {
JSONParser jsonParser = new JSONParser();
JSONObject jsonObject = (JSONObject) jsonParser.parse(content);
JSONObject jsonObject = (JSONObject) jsonParser.parse(reader);
point = geometryFactory.createPoint(coordinate);
features = (List<JSONObject>) jsonObject.get("features");
} catch (Exception e) {
e.printStackTrace();
}catch(Exception e) {
e.getStackTrace();
}
return this.contains(features, point);
}

Loading…
Cancel
Save