增加网格员坐标 baidu09 -> 84 转换
This commit is contained in:
parent
b5e2f02b3a
commit
d9701a668b
@ -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/";
|
String baseDir = "/Users/wanggeng/Desktop/";
|
||||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(baseDir + "/gridPoint.json")));
|
BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(baseDir + "/gridPoint.json")));
|
||||||
StringBuilder sourceJsonArraySB = new StringBuilder();
|
StringBuilder sourceJsonArraySB = new StringBuilder();
|
||||||
@ -76,4 +76,39 @@ class SmartCityUsercenterApplicationTests {
|
|||||||
System.out.println(sb);
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user