提交 d8d7e1fd authored 作者: 王健's avatar 王健

修改页面参数

修改天地图进程
上级 7479a56b
......@@ -71,8 +71,7 @@ public class DownMapService {
public Map<String, Object> downLoad(Map<String, Object> body, Session session) throws Exception {
this.stoped = false;
es = Executors.newFixedThreadPool(threadNum);
completionService = new ExecutorCompletionService<>(es);
//记录返回结果
Map<String, Object> resBody = new HashMap<>();
//记录异步结果
......@@ -94,7 +93,15 @@ public class DownMapService {
String filePath = jsonParam.getStr("filePath");
CLStringUtil.BASE_PATH = filePath + File.separator;
// 开始下载s
// 设置下载地址
String source = jsonParam.getStr("source");
CLStringUtil.BASE_URL = source;
int threadNumInput = jsonParam.getInt("threadNum");
es = Executors.newFixedThreadPool(threadNumInput);
completionService = new ExecutorCompletionService<>(es);
// 开始下载
for (int i = 0; i < level.size(); i++) { // 层级
int z = level.getInt(i);
//计算行列号(使用瓦片的中心点经纬度计算)
......@@ -253,6 +260,7 @@ public class DownMapService {
}
//高德地图(6:影像,7:矢量,8:影像路网)
imgUrl = CLStringUtil.getImgUrl(z, x, y);
log.info(imgUrl);
file = (!appendFlag) ? CLStringUtil.getFullFileNotExist(z, x, y) : CLStringUtil.getFullFile(z, x, y);
// 开始下载地图
......
......@@ -14,6 +14,7 @@ import javax.annotation.PostConstruct;
import java.io.File;
import java.text.DecimalFormat;
import java.util.Map;
import java.util.Random;
/**
* @ClassName LDStringUtil
......@@ -122,7 +123,10 @@ public class CLStringUtil {
* @date: 2020/4/2
**/
public static String getImgUrl(Integer z, Integer x, Integer y) {
String url = BASE_URL.replaceAll("\\{x\\}", String.valueOf(x)).replaceAll("\\{y\\}", String.valueOf(y))
Random rand = new Random();
int k = rand.nextInt((7 - 0) + 1) + 0;
String url = BASE_URL.replaceAll("\\{k\\}", String.valueOf(k)).replaceAll("\\{x\\}", String.valueOf(x)).replaceAll("\\{y\\}", String.valueOf(y))
.replaceAll("\\{z\\}", String.valueOf(z));
return url;
}
......
......@@ -59,6 +59,7 @@ public class HttpUtil {
try {
HttpGet httpGet = new HttpGet(url);
httpGet.setConfig(staticRequestConfig);
httpGet.setHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36");
response = staticHttpClient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == 200){
ins = response.getEntity().getContent();
......
package com.comleader.ldmapdownload.util;
import java.util.Random;
/**
* @Description
* @Author wangjian
* @Date 2021/1/6 12:01 下午
*/
public class demo {
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
}
}
}
# 下载地图瓦片的保存路径
# ���ص�ͼ��Ƭ�ı���·��
#file.basepath=/Users/echo/Desktop/em-map
file.basepath=H:/em-map
# 项目发布的瓦片图片地
file.basepath=~/download
# ��Ŀ��������ƬͼƬ��ַ
#file.mapImgPath=Users/echo/Desktop/em-map
file.mapImgPath=H:/em-map
file.mapImgPath=~/download
# 下载地图的地
# ���ص�ͼ�ĵ�ַ
map.baseurl=http://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1scale=1&style=8&x={x}&y={y}&z={z}
#map.baseurl=http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}
# 下载地图的类型 CUSTOM ArcGIS,一般CUSTOM就可
# ���ص�ͼ������ CUSTOM ArcGIS,һ��CUSTOM�Ϳ�
map.type=CUSTOM
# 线程数 下载地图瓦片时的线程数
# �߳��� ���ص�ͼ��Ƭʱ���߳���
map.threadNum=2000
# 是否下载前8级(如果开启默认打开时会直接自动下载前八级的,前八级因为瓦片数量不是很多,一般会选择下载全球的)
# �Ƿ�����ǰ8��(�������Ĭ�ϴ�ʱ��ֱ���Զ�����ǰ�˼���,ǰ�˼���Ϊ��Ƭ�������Ǻܶ�,һ���ѡ������ȫ���)
map.Lv8.flag=false
# 是否覆盖已有(该属性也可以通过前端传入)
# �Ƿ񸲸�����(������Ҳ����ͨ��ǰ�˴���)
map.download.append=false
......@@ -29,6 +29,20 @@
<div class="input-card" style="width: 32rem;">
<h3>领图下载器</h3>
<h4>基本设置</h4>
<div class="input-item">
<div class="input-item-prepend"><span class="input-item-text">地图服务</span></div>
<select id='source' style="width:100px">
<option value="http://webst04.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}" selected>高德影像</option>
<option value="http://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1scale=1&style=6&x={x}&y={y}&z={z}">高德</option>
<option value="http://www.google.cn/maps/vt?lyrs=m@189&gl=cn&x={x}&y={y}&z={z}">Google</option>
<option value="https://t{k}.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=361fe395b6a2282a508e765ee54288c9">天地图影像</option>
</select>
</div>
<div class="input-item">
<div class="input-item-prepend"><span class="input-item-text">线程数</span></div>
<input id='thread_num' class="input-item" type="text" placeholder="默认线程数2000" style="width:100px" value="2000"/>
</div>
<h4>下载区域</h4>
<div class="input-item">
<div class="input-item-prepend"><span class="input-item-text">省市区</span></div>
......@@ -229,6 +243,8 @@
var filePath = $("#filePath").val();
// 是否覆盖下载
var appendFlag = $("#append").val();
var source = $("#source").val();
var threadNum = $("#thread_num").val();
var body = {
level: levelList,
appendFlag: appendFlag,
......@@ -236,7 +252,9 @@
minLat: minLat,
maxLng: maxLng,
maxLat: maxLat,
filePath: filePath
filePath: filePath,
source: source,
threadNum: threadNum
};
var data = {
type: 1,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论