Browse Source

feat : geojson 읽어오는 방식 rollback

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

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

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

Loading…
Cancel
Save