项目场景:
参考 https://github.com/mapbox/tippecanoe 进行下载安装和查看使用的参数说明
使用程序动态调用 tippecanoe 对geojson进行矢量切片,前端使用mapboxjs
问题描述
整体为了解决百兆geojson前端无法加载或加载卡顿的问题,添加的参数是为了解决 tippecanoe 会对geojson按照层级抽稀的问题,有抽稀需求可以参照官方文档调整参数值
ProcessBuilder builder = new ProcessBuilder(
"tippecanoe", "-z14", "-l", "default", "--no-tile-compression",
"--no-feature-limit", "--no-tile-size-limit", "--simplification=1",
"--drop-rate=0", "--extend-zooms-if-still-dropping", "-f", "-e",
nginxPath + "aisFile/pbfFile/",
jsonFile.getAbsolutePath()
);
Process process = builder.start();
// 处理标准输出
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
log.info("生成矢量切片------返回结果: {}", line);
}
// 处理错误输出
BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
String errorLine;
while ((errorLine = errorReader.readLine()) != null) {
log.info("生成矢量切片 111------返回结果: {}", errorLine);
}
boolean exitCode = process.waitFor(Constants.twenty, TimeUnit.MINUTES);
log.info("生成矢量切片------执行完任务断开连接");