| | |
| | | return success(filePatn + "raingage.sem"); |
| | | } |
| | | |
| | | @ApiOperation(value = "管ç¹è½¬cityjson") |
| | | @GetMapping(value = "/pointToCityJson", produces = "application/json; charset=UTF-8") |
| | | public R<String> pointToCityJson(@RequestParam("shpPath") String shpPath) throws Exception { |
| | | @ApiOperation(value = "管ç¹è½¬sem") |
| | | @PostMapping(value = "/pointTosem", produces = "application/json; charset=UTF-8") |
| | | public R<String> pointTosem(@RequestBody List<GridDto> dtos) throws Exception { |
| | | String path = outPath + "\\point\\"; |
| | | List<Map<String, Object>> list = ShpReadUtils.readPointShp(shpPath); |
| | | String publicKey = EntityLibraryUtils.getPublicKey(); |
| | | String token = EntityLibraryUtils.login(); |
| | | JSONArray jsonArrayList = EntityLibraryUtils.getPointInfo(dtos, token); |
| | | JSONObject jsonObject = getModule("pointmodule.json"); |
| | | for (Map<String, Object> map : list |
| | | ) { |
| | | for (int s = 0; s < jsonArrayList.size(); s++) { |
| | | JSONObject pointObject = jsonArrayList.getJSONObject(s); |
| | | //æ¼è£
åæ |
| | | JSONArray vertice = new JSONArray(); |
| | | vertice.add(map.get("lon")); |
| | | vertice.add(map.get("lat")); |
| | | vertice.add(Double.valueOf(pointObject.getString("lon"))); |
| | | vertice.add(Double.valueOf(pointObject.getString("lat"))); |
| | | vertice.add(0.0); |
| | | jsonObject.getJSONArray("vertices").add(vertice); |
| | | //æ¼è£
åºç¡ä¿¡æ¯ |
| | | JSONObject cityObject = new JSONObject(); |
| | | cityObject.put("type", "+PipePoint"); |
| | | JSONObject attribute = new JSONObject(); |
| | | attribute.put("name", map.get("fsw")); |
| | | attribute.put("ç»´æ¤æ¶é´", pointObject.get("operatetime")); |
| | | attribute.put("ç»´æ¤äºº", pointObject.get("operator")); |
| | | attribute.put("å¯ä¸ç¼ç ", pointObject.get("seid")); |
| | | attribute.put("ID", pointObject.get("id")); |
| | | attribute.put("enti_uuid", pointObject.get("enti_uuid")); |
| | | attribute.put("æ è¯ç ", pointObject.get("bsm")); |
| | | attribute.put("管线ç§ç±»", pointObject.get("gxzl")); |
| | | attribute.put("å°é¢é«ç¨", pointObject.get("dmgc")); |
| | | attribute.put("ç¹å¾", pointObject.get("tz")); |
| | | attribute.put("éå±ç©", pointObject.get("fsw")); |
| | | attribute.put("建çç©", pointObject.get("jzw")); |
| | | attribute.put("äºåºé«ç¨", pointObject.get("jdgc")); |
| | | attribute.put("äºåºåæ·±", pointObject.get("jdms")); |
| | | attribute.put("äºèåæ·±", pointObject.get("jbms")); |
| | | attribute.put("äºçå½¢ç¶", pointObject.get("jgxz")); |
| | | attribute.put("äºç尺寸", pointObject.get("jgcc")); |
| | | attribute.put("äºçæè´¨", pointObject.get("jgcz")); |
| | | attribute.put("äºçç¶æ", pointObject.get("jgzt")); |
| | | attribute.put("äºèæè´¨", pointObject.get("jbcz")); |
| | | attribute.put("äºè尺寸", pointObject.get("jbcc")); |
| | | attribute.put("äºæè´¨", pointObject.get("jcz")); |
| | | attribute.put("äºå°ºå¯¸", pointObject.get("jcc")); |
| | | attribute.put("使ç¨ç¶åµ", pointObject.get("syzk")); |
| | | attribute.put("lon", Double.valueOf(pointObject.getString("lon"))); |
| | | attribute.put("lat", Double.valueOf(pointObject.getString("lat"))); |
| | | attribute.put("atti", pointObject.get("atti")); |
| | | attribute.put("鍿°´éç»ç¹", pointObject.get("ysjjd")); |
| | | cityObject.put("attributes", attribute); |
| | | JSONArray geometry = new JSONArray(); |
| | | JSONObject metry = new JSONObject(); |
| | |
| | | SemUtils.cityJsonToSem(pointPath, filePatn + "node.sem"); |
| | | return success(filePatn + "node.sem"); |
| | | } |
| | | // @ApiOperation(value = "管ç¹è½¬cityjson") |
| | | // @GetMapping(value = "/pointToCityJson", produces = "application/json; charset=UTF-8") |
| | | // public R<String> pointToCityJson(@RequestParam("shpPath") String shpPath) throws Exception { |
| | | // String path = outPath + "\\point\\"; |
| | | // List<Map<String, Object>> list = ShpReadUtils.readPointShp(shpPath); |
| | | // JSONObject jsonObject = getModule("pointmodule.json"); |
| | | // for (Map<String, Object> map : list |
| | | // ) { |
| | | // //æ¼è£
åæ |
| | | // JSONArray vertice = new JSONArray(); |
| | | // vertice.add(map.get("lon")); |
| | | // vertice.add(map.get("lat")); |
| | | // vertice.add(0.0); |
| | | // jsonObject.getJSONArray("vertices").add(vertice); |
| | | // //æ¼è£
åºç¡ä¿¡æ¯ |
| | | // JSONObject cityObject = new JSONObject(); |
| | | // cityObject.put("type", "+PipePoint"); |
| | | // JSONObject attribute = new JSONObject(); |
| | | // attribute.put("name", map.get("fsw")); |
| | | // cityObject.put("attributes", attribute); |
| | | // JSONArray geometry = new JSONArray(); |
| | | // JSONObject metry = new JSONObject(); |
| | | // metry.put("type", "MultiPoint"); |
| | | // metry.put("lod", 0); |
| | | // JSONArray boundarie = new JSONArray(); |
| | | // boundarie.add(jsonObject.getJSONArray("vertices").size() - 1); |
| | | // metry.put("boundaries", boundarie); |
| | | // geometry.add(metry); |
| | | // cityObject.put("geometry", geometry); |
| | | // jsonObject.getJSONObject("CityObjects").put("UUID_" + UUID.randomUUID().toString(), cityObject); |
| | | // } |
| | | // long times = System.currentTimeMillis(); |
| | | // String pointPath = path + times + "\\管ç¹.json"; |
| | | // File dirFile = new File(path + times); |
| | | // if (!dirFile.exists()) { |
| | | // dirFile.mkdirs(); |
| | | // } |
| | | // FileWriter fileWriter = new FileWriter(pointPath); |
| | | // fileWriter.write(jsonObject.toJSONString()); |
| | | // fileWriter.close(); |
| | | // String filePatn = inPath + "\\tongzhou\\"; |
| | | // File file = new File(filePatn); |
| | | // if (!file.exists()) { |
| | | // file.mkdirs(); |
| | | // } |
| | | // SemUtils.cityJsonToSem(pointPath, filePatn + "node.sem"); |
| | | // return success(filePatn + "node.sem"); |
| | | // } |
| | | |
| | | @ApiOperation(value = "管线semçæ") |
| | | @PostMapping(value = "/lineToSem", produces = "application/json; charset=UTF-8") |
| | | public R<String> lineToSem(@RequestBody List<GridDto> dtos) throws Exception { |
| | | String path = outPath + "\\line\\"; |
| | | JSONArray jsonArrayList = EntityLibraryUtils.getPointInfo(dtos); |
| | | String publicKey = EntityLibraryUtils.getPublicKey(); |
| | | String token = EntityLibraryUtils.login(); |
| | | JSONArray jsonArrayList = EntityLibraryUtils.getLineInfo(dtos, token); |
| | | if (jsonArrayList.size() == 0) { |
| | | return fail("该åºåä¸åå¨ç®¡çº¿ï¼"); |
| | | } |
| | |
| | | } |
| | | String sql = stringBuffer.toString(); |
| | | sql = sql.substring(0, sql.length() - 1) + ")"; |
| | | String publicKey = EntityLibraryUtils.getPublicKey(); |
| | | StringBuffer paramBuffer = new StringBuffer(""); |
| | | while (!"".equals(sql)) { |
| | | if (sql.length() > 110) { |
| | |
| | | } |
| | | } |
| | | String src=paramBuffer.toString().substring(0, paramBuffer.length() - 1); |
| | | JSONArray arrayDetail = EntityLibraryUtils.getPointDetail(src); |
| | | //todo æ¿æ¢mapencodedString |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | JSONArray arrayDetail = EntityLibraryUtils.getLineDetail(src, token); |
| | | JSONObject jsonObject = getModule("linemodule.json"); |
| | | for (int i = 0; i < arrayDetail.size(); i++) { |
| | | JSONObject detailJSONObject = arrayDetail.getJSONObject(i); |
| | | //æ¼è£
åºç¡ä¿¡æ¯ |
| | | JSONObject cityObject = new JSONObject(); |
| | | cityObject.put("type", "+PipeLine"); |
| | | JSONObject attribute = new JSONObject(); |
| | | attribute.put("ç»´æ¤æ¶é´", detailJSONObject.getJSONObject("properties").getLong("operatetime")); |
| | | attribute.put("ç»´æ¤äºº", detailJSONObject.getJSONObject("properties").getString("operator")); |
| | | attribute.put("å¯ä¸ç¼ç ", detailJSONObject.getJSONObject("properties").get("seid")); |
| | | attribute.put("ENTI_UUID", detailJSONObject.getJSONObject("properties").get("enti_uuid")); |
| | | attribute.put("ID", detailJSONObject.getJSONObject("properties").get("id")); |
| | | attribute.put("lon", detailJSONObject.getJSONObject("properties").get("lon")); |
| | | attribute.put("lat", detailJSONObject.getJSONObject("properties").get("lat")); |
| | | attribute.put("atti", detailJSONObject.getJSONObject("properties").get("atti")); |
| | | attribute.put("管线ç§ç±»", detailJSONObject.getJSONObject("properties").get("gxzl")); |
| | | attribute.put("èµ·ç¹æ è¯ç ", detailJSONObject.getJSONObject("properties").get("qdbsm")); |
| | | attribute.put("æ¢ç¹æ è¯ç ", detailJSONObject.getJSONObject("properties").get("zdbsm")); |
| | | attribute.put("èµ·ç¹é«ç¨", detailJSONObject.getJSONObject("properties").get("qdgc")); |
| | | attribute.put("èµ·é«ç¨ç±»å", detailJSONObject.getJSONObject("properties").get("qgclx")); |
| | | attribute.put("èµ·ç¹åæ·±", detailJSONObject.getJSONObject("properties").get("qdms")); |
| | | attribute.put("æ¢ç¹é«ç¨", detailJSONObject.getJSONObject("properties").get("zdgc")); |
| | | attribute.put("æ¢é«ç¨ç±»å", detailJSONObject.getJSONObject("properties").get("zgclx")); |
| | | attribute.put("æ¢ç¹åæ·±", detailJSONObject.getJSONObject("properties").get("zdms")); |
| | | attribute.put("æè´¨", detailJSONObject.getJSONObject("properties").get("cz")); |
| | | attribute.put("å设æ¹å¼", detailJSONObject.getJSONObject("properties").get("msfs")); |
| | | attribute.put("管å¾1", detailJSONObject.getJSONObject("properties").get("gja")); |
| | | attribute.put("管å¾2", detailJSONObject.getJSONObject("properties").get("gjb")); |
| | | attribute.put("使ç¨ç¶åµ", detailJSONObject.getJSONObject("properties").get("syzk")); |
| | | attribute.put("管线段é¿åº¦", detailJSONObject.getJSONObject("properties").get("gxdcd")); |
| | | attribute.put("groupID", detailJSONObject.getJSONObject("properties").get("groupid")); |
| | | attribute.put("Shape_Length", detailJSONObject.getJSONObject("properties").get("shape_length")); |
| | | attribute.put("æ è¯ç ", detailJSONObject.getJSONObject("properties").get("bsm")); |
| | | JSONArray geometry = new JSONArray(); |
| | | JSONObject metry = new JSONObject(); |
| | | metry.put("type", "MultiLineString"); |
| | | metry.put("lod", 0); |
| | | JSONArray boundarie = new JSONArray(); |
| | | JSONArray array = detailJSONObject.getJSONObject("geometry").getJSONArray("coordinates").getJSONArray(0); |
| | | for (int m = 0; m < array.size(); m++) { |
| | | JSONArray object = array.getJSONArray(m); |
| | | jsonObject.getJSONArray("vertices").add(ProjectionToGeographicUtil.getPoint(object.getDouble(0), object.getDouble(1))); |
| | | boundarie.add(jsonObject.getJSONArray("vertices").size() - 1); |
| | | } |
| | | JSONArray jsonArray = new JSONArray(); |
| | | jsonArray.add(boundarie); |
| | | metry.put("boundaries", jsonArray); |
| | | JSONArray metryArray = new JSONArray(); |
| | | metryArray.add(metry); |
| | | cityObject.put("geometry", metryArray); |
| | | cityObject.put("attributes", attribute); |
| | | cityObject.put("attributes", attribute); |
| | | geometry.add(metry); |
| | | jsonObject.getJSONObject("CityObjects").put("UUID_" + UUID.randomUUID().toString(), cityObject); |
| | | } |
| | | long times = System.currentTimeMillis(); |
| | | String pointPath = path + times + "\\管线.json"; |
| | | File dirFile = new File(path + times); |
| | | if (!dirFile.exists()) { |
| | | dirFile.mkdirs(); |
| | | } |
| | | FileWriter fileWriter = new FileWriter(pointPath); |
| | | fileWriter.write(jsonObject.toJSONString()); |
| | | fileWriter.close(); |
| | | String filePatn = inPath + "\\tongzhou\\"; |
| | | File file = new File(filePatn); |
| | | if (!file.exists()) { |
| | | file.mkdirs(); |
| | | } |
| | | SemUtils.cityJsonToSem(pointPath, filePatn + "link.sem"); |
| | | return success(filePatn + "link.sem"); |
| | | } |
| | | |
| | | @ApiOperation(value = "管线转cityjson") |
| | | @GetMapping(value = "/lineToCityJson", produces = "application/json; charset=UTF-8") |
| | | public R<String> lineToCityJson(@RequestParam("shpPath") String shpPath) throws Exception { |
| | | String path = outPath + "\\line\\"; |
| | | List<Map<String, Object>> list = ShpReadUtils.readPointShp(shpPath); |
| | | JSONObject jsonObject = getModule("linemodule.json"); |
| | | for (Map<String, Object> map : list |
| | | ) { |
| | |
| | | SemUtils.cityJsonToSem(pointPath, filePatn + "link.sem"); |
| | | return success(filePatn + "link.sem"); |
| | | } |
| | | // @ApiOperation(value = "管线转cityjson") |
| | | // @GetMapping(value = "/lineToCityJson", produces = "application/json; charset=UTF-8") |
| | | // public R<String> lineToCityJson(@RequestParam("shpPath") String shpPath) throws Exception { |
| | | // String path = outPath + "\\line\\"; |
| | | // List<Map<String, Object>> list = ShpReadUtils.readPointShp(shpPath); |
| | | // JSONObject jsonObject = getModule("linemodule.json"); |
| | | // for (Map<String, Object> map : list |
| | | // ) { |
| | | // //æ¼è£
åºç¡ä¿¡æ¯ |
| | | // JSONObject cityObject = new JSONObject(); |
| | | // cityObject.put("type", "+PipeLine"); |
| | | // JSONObject attribute = new JSONObject(); |
| | | // attribute.put("name", map.get("msfs")); |
| | | // JSONArray geometry = new JSONArray(); |
| | | // JSONObject metry = new JSONObject(); |
| | | // metry.put("type", "MultiLineString"); |
| | | // metry.put("lod", 0); |
| | | // JSONArray boundarie = new JSONArray(); |
| | | // JSONArray array = JSONObject.parseObject(map.get("the_geom").toString()).getJSONArray("coordinates"); |
| | | // for (int i = 0; i < array.size(); i++) { |
| | | // JSONObject object = JSONObject.parseObject(array.get(i).toString()); |
| | | // jsonObject.getJSONArray("vertices").add(ProjectionToGeographicUtil.getPoint(Double.valueOf(object.get("x").toString()), Double.valueOf(object.get("y").toString()))); |
| | | // boundarie.add(jsonObject.getJSONArray("vertices").size() - 1); |
| | | // } |
| | | // JSONArray jsonArray = new JSONArray(); |
| | | // jsonArray.add(boundarie); |
| | | // metry.put("boundaries", jsonArray); |
| | | // JSONArray metryArray = new JSONArray(); |
| | | // metryArray.add(metry); |
| | | // cityObject.put("geometry", metryArray); |
| | | // cityObject.put("attributes", attribute); |
| | | // cityObject.put("attributes", attribute); |
| | | // geometry.add(metry); |
| | | // jsonObject.getJSONObject("CityObjects").put("UUID_" + UUID.randomUUID().toString(), cityObject); |
| | | // } |
| | | // long times = System.currentTimeMillis(); |
| | | // String pointPath = path + times + "\\管线.json"; |
| | | // File dirFile = new File(path + times); |
| | | // if (!dirFile.exists()) { |
| | | // dirFile.mkdirs(); |
| | | // } |
| | | // FileWriter fileWriter = new FileWriter(pointPath); |
| | | // fileWriter.write(jsonObject.toJSONString()); |
| | | // fileWriter.close(); |
| | | // String filePatn = inPath + "\\tongzhou\\"; |
| | | // File file = new File(filePatn); |
| | | // if (!file.exists()) { |
| | | // file.mkdirs(); |
| | | // } |
| | | // SemUtils.cityJsonToSem(pointPath, filePatn+ "link.sem"); |
| | | // return success(filePatn + "link.sem"); |
| | | // } |
| | | |
| | | @ApiOperation(value = "å°å½¢è½¬cityjson") |
| | | @GetMapping(value = "/terrainToCityJson", produces = "application/json; charset=UTF-8") |