From d9701a668b5c1073c9ffe9414b23ab823861334b Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Mon, 10 Jan 2022 09:30:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E6=A0=BC=E5=91=98?= =?UTF-8?q?=E5=9D=90=E6=A0=87=20baidu09=20->=2084=20=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SmartCityUsercenterApplicationTests.java | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/test/java/cn/com/tenlion/usercenter/SmartCityUsercenterApplicationTests.java b/src/test/java/cn/com/tenlion/usercenter/SmartCityUsercenterApplicationTests.java index d20a70a..0012e86 100644 --- a/src/test/java/cn/com/tenlion/usercenter/SmartCityUsercenterApplicationTests.java +++ b/src/test/java/cn/com/tenlion/usercenter/SmartCityUsercenterApplicationTests.java @@ -34,7 +34,7 @@ class SmartCityUsercenterApplicationTests { } } - public static void main(String[] args) throws IOException { + public static void gridPoint() throws IOException { String baseDir = "/Users/wanggeng/Desktop/"; BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(baseDir + "/gridPoint.json"))); StringBuilder sourceJsonArraySB = new StringBuilder(); @@ -76,4 +76,39 @@ class SmartCityUsercenterApplicationTests { System.out.println(sb); } + public static void gridMember() throws IOException { + String baseDir = "/Users/wanggeng/Desktop/乌兰察布市域社会治理/数字冰雹"; + BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(baseDir + "/网格员.json"))); + StringBuilder sourceJsonArraySB = new StringBuilder(); + for (String line; (line = bufferedReader.readLine()) != null; ) { + sourceJsonArraySB.append(line); + } + JSONArray sourceJsonArray = JSONArray.parseArray(sourceJsonArraySB.toString()); + JSONArray map84GridJsonArray = new JSONArray(); + for (int i = 0; i < sourceJsonArray.size(); i++) { + JSONObject gridJSONObject = sourceJsonArray.getJSONObject(i); + JSONObject map84GridJSONObject = new JSONObject(); + map84GridJSONObject.put("userName", gridJSONObject.getString("userName")); + + JSONObject pointJSONObject = gridJSONObject.getJSONObject("point"); + double lat = pointJSONObject.getDoubleValue("lat"); + double lng = pointJSONObject.getDoubleValue("lng"); + double[] latLng = LatLngTransformUtil.bd09_To_gps84(lat, lng); + + JSONObject map84Point = new JSONObject(); + map84Point.put("lat", String.valueOf(latLng[0])); + map84Point.put("lng", String.valueOf(latLng[1])); + map84GridJSONObject.put("point", map84Point); + + map84GridJsonArray.add(map84GridJSONObject); + } + System.out.println(map84GridJsonArray); + } + + public static void main(String[] args) throws IOException { + gridMember(); + } + + + }