| | |
| | | fileWriter.close(); |
| | | return success(pointPath); |
| | | } |
| | | |
| | | @ApiOperation(value = "地形转cityjson") |
| | | @GetMapping(value = "/terrainToCityJson", produces = "application/json; charset=UTF-8") |
| | | public R<String> terrainToCityJson(@RequestParam("tifPath") String tifPath) throws Exception { |
| | | long times = System.currentTimeMillis(); |
| | | String path = outPath + "\\terrain\\"+times+"\\"; |
| | | File dirFile = new File(path+"appearance"); |
| | | if (!dirFile.exists()) { |
| | | dirFile.mkdirs(); |
| | | } |
| | | String pngPath=path+"appearance\\terrain.png"; |
| | | TiffToRGBUtil.tiffToPng(tifPath,pngPath); |
| | | JSONObject jsonObject = getModule("terrainmodule.json"); |
| | | jsonObject.put("vertices",TiffCoordinateExtractorUtil.getCoordinate(tifPath)); |
| | | FileWriter fileWriter = new FileWriter(path + "terrain.json"); |
| | | fileWriter.write(jsonObject.toJSONString()); |
| | | fileWriter.close(); |
| | | return success(path); |
| | | } |
| | | public JSONObject getModule(String moduleName) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | try { |