|
|
|
@ -15,6 +15,8 @@ import org.springframework.core.io.Resource;
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
import java.io.FileReader; |
|
|
|
|
import java.io.InputStream; |
|
|
|
|
import java.io.InputStreamReader; |
|
|
|
|
import java.io.Reader; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
@ -172,14 +174,12 @@ public class AreaUtils {
|
|
|
|
|
|
|
|
|
|
public void init() throws Exception { |
|
|
|
|
// GeometryFactory geometryFactory = new GeometryFactory();
|
|
|
|
|
|
|
|
|
|
// 1. file read
|
|
|
|
|
Resource resource = new ClassPathResource("air/airgeo.json"); |
|
|
|
|
Reader jsonFile = new FileReader(resource.getFile()); |
|
|
|
|
|
|
|
|
|
ClassPathResource resource = new ClassPathResource("air/airgeo.json"); |
|
|
|
|
InputStream jsonInputStream = resource.getInputStream(); |
|
|
|
|
// 2. json parsing
|
|
|
|
|
JSONParser jsonParser = new JSONParser(); |
|
|
|
|
JSONObject jsonObject = (JSONObject) jsonParser.parse(jsonFile); |
|
|
|
|
JSONObject jsonObject = (JSONObject) jsonParser.parse(new InputStreamReader(jsonInputStream, "UTF-8")); |
|
|
|
|
|
|
|
|
|
List<JSONObject> features = (List<JSONObject>) jsonObject.get("features"); |
|
|
|
|
|
|
|
|
|