0c4e300c by chiangbt

first commit

1 parent 04dba9af
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
</project>
\ No newline at end of file
......
## 项目说明
TiandituDownload主要用于下载天地图数据,其坐标系为CGCS2000.
```java
// 设置要下载的图片存储sqlite路径
TiandituDownload tiandituDownload = new TiandituDownload("my.db");
// 范围起始点(左下角、右上角)
Point pt = new Point(29.76,106.64);
Point pt2 = new Point(35.33, 108.12);
// 下载器
// 2 为最小level,9为最大level,
tiandituDownload.Download(pt, pt2, 2,9, TianDiTuTiledMapServiceType.IMG_C);
```
\ No newline at end of file
......
import utils.Point;
import utils.TianDiTuTiledMapServiceType;
import java.sql.SQLException;
public class Main {
......@@ -9,7 +12,7 @@ public class Main {
TiandituDownload tiandituDownload = new TiandituDownload("my.db");
Point pt = new Point(29.76,106.64);
Point pt2 = new Point(35.33, 108.12);
// tiandituDownload.Download(pt, pt2, 9, TianDiTuTiledMapServiceType.IMG_C);
// tiandituDownload.Download(pt, pt2, 9, utils.TianDiTuTiledMapServiceType.IMG_C);
tiandituDownload.Download(pt, pt2, 2,9, TianDiTuTiledMapServiceType.IMG_C);
}
}
......
import utils.CalEnv;
import utils.Point;
import utils.TDTUrl;
import utils.TianDiTuTiledMapServiceType;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.net.HttpURLConnection;
......
package utils;
public class CalEnv {
private int startX;
......
package utils;
public class Point {
private double lat;
......
......@@ -2,6 +2,8 @@ package utils;
import java.util.Random;
import static utils.TianDiTuTiledMapServiceType.*;
/**
* Created by jiangbotao on 2018/3/23.
*/
......@@ -27,28 +29,28 @@ public class TDTUrl {
int subdomain = (random.nextInt(6) + 1);
url.append(subdomain);
switch (this._tiandituMapServiceType) {
case TianDiTuTiledMapServiceType.VEC_C:
case VEC_C:
url.append(".tianditu.com/DataServer?T=vec_c&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
break;
case TianDiTuTiledMapServiceType.CVA_C:
case CVA_C:
url.append(".tianditu.com/DataServer?T=cva_c&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
break;
case TianDiTuTiledMapServiceType.CIA_C:
case CIA_C:
url.append(".tianditu.com/DataServer?T=cia_c&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
break;
case TianDiTuTiledMapServiceType.IMG_C:
case IMG_C:
url.append(".tianditu.com/DataServer?T=img_c&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
break;
case TianDiTuTiledMapServiceType.VEC_W:
case VEC_W:
url.append(".tianditu.com/DataServer?T=vec_w&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
break;
case TianDiTuTiledMapServiceType.CVA_W:
case CVA_W:
url.append(".tianditu.com/DataServer?T=cva_w&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
break;
case TianDiTuTiledMapServiceType.CIA_W:
case CIA_W:
url.append(".tianditu.com/DataServer?T=cia_w&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
break;
case TianDiTuTiledMapServiceType.IMG_W:
case IMG_W:
url.append(".tianditu.com/DataServer?T=img_w&X=").append(this._col).append("&Y=").append(this._row).append("&L=").append(this._level);
break;
default:
......
package utils;
/**
* Created by jiangbotao on 2018/3/23.
......