提交 f9255149 authored 作者: 张航's avatar 张航

添加了默认下载基础地图以及地图的发布

上级 e7586d80
package com.comleader.ldmapdownload.config;
import com.comleader.ldmapdownload.util.CLStringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* @ClassName WebMvcConfig
* @Description: WebMvcConfig配置类(设置地图资源静态路径)
* @Author zhanghang
* @Date 2020/4/14
* @Version V1.0
**/
@Configuration
@PropertySource(value = {"classpath:config/download-map.properties"}, encoding = "UTF-8")
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Value("${file.mapImgPath}")
private String mapImgPath;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations("file:/"+ mapImgPath +"/");
super.addResourceHandlers(registry);
}
}
......@@ -29,9 +29,10 @@ public class DownMapLv3 {
for (int y = 0; y <= 7; y++) { // X轴
//高德地图(6:影像,7:矢量,8:影像路网)
String imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y);
File file = CLStringUtil.getFullFileNotExist(z, x, y);
System.out.println(imgUrl);
// 开始下载地图
if (file != null) {
try {
HttpUtil.downImageByGet(imgUrl, file);
} catch (Exception e) {
......@@ -39,6 +40,7 @@ public class DownMapLv3 {
}
}
}
}
}).start();
}
......
......@@ -29,10 +29,11 @@ public class DownMapLv4 {
for (int y = 0; y <= 9; y++) { // X轴
//高德地图(6:影像,7:矢量,8:影像路网)
String imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y);
File file = CLStringUtil.getFullFileNotExist(z, x, y);
System.out.println(imgUrl);
// 开始下载地图
if (file != null) {
try {
HttpUtil.downImageByGet(imgUrl, file);
} catch (Exception e) {
......@@ -40,6 +41,7 @@ public class DownMapLv4 {
}
}
}
}
}).start();
}
......
......@@ -17,8 +17,8 @@ public class DownMapLv5 {
private static int z = 5;
/**
* @description: 下载第四级的Map
* @param
* @description: 下载第四级的Map
* @return: void
* @author: zhanghang
* @date: 2020/4/3
......@@ -29,10 +29,11 @@ public class DownMapLv5 {
for (int y = 10; y <= 23; y++) { // X轴
//高德地图(6:影像,7:矢量,8:影像路网)
String imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y);
File file = CLStringUtil.getFullFileNotExist(z, x, y);
System.out.println(imgUrl);
// 开始下载地图
if (file != null) {
try {
HttpUtil.downImageByGet(imgUrl, file);
} catch (Exception e) {
......@@ -40,6 +41,7 @@ public class DownMapLv5 {
}
}
}
}
}).start();
}
......
......@@ -17,8 +17,8 @@ public class DownMapLv6 {
private static int z = 6;
/**
* @description: 下载第四级的Map
* @param
* @description: 下载第四级的Map
* @return: void
* @author: zhanghang
* @date: 2020/4/3
......@@ -29,10 +29,11 @@ public class DownMapLv6 {
for (int y = 20; y <= 28; y++) { // X轴
//高德地图(6:影像,7:矢量,8:影像路网)
String imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y);
File file = CLStringUtil.getFullFileNotExist(z, x, y);
System.out.println(imgUrl);
// 开始下载地图
if (file != null) {
try {
HttpUtil.downImageByGet(imgUrl, file);
} catch (Exception e) {
......@@ -40,6 +41,7 @@ public class DownMapLv6 {
}
}
}
}
}).start();
}
......
......@@ -36,6 +36,5 @@ public class DownMapLv6Runner implements ApplicationRunner {
DownMapLv4.downLoad();
DownMapLv5.downLoad();
DownMapLv6.downLoad();
}
}
# 下载地图的保存路径
file.basepath=E:/em-downloadmap
# 项目的发布地址
file.mapImgPath=E:/em-downloadmap
# 下载地图的地址
#天地图服务器t0-t8间选一个
......@@ -25,7 +27,7 @@ map.maxLv=15
map.threadNum=2000
# 是否下载前6级(不能与其余的同时进行)
map.Lv6.flag=false
map.Lv6.flag=true
# 是否覆盖已有
map.download.append=false
......
......@@ -197,7 +197,7 @@
// 校验信息
if (verifyParam()) {
// 开始建立连接
$("#filePath").val($("#filePath").val());
// $("#filePath").val($("#filePath").val());
sendReady();
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论