Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
蒋波涛
/
tianditudownloader
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
05db60ef
authored
2018-03-27 10:23:59 +0800
by
chiangbt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update 3.27
1 parent
b5905b49
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
11 deletions
.idea/workspace.xml
src/Main.java
src/TiandituDownload.java
.idea/workspace.xml
View file @
05db60e
This diff is collapsed.
Click to expand it.
src/Main.java
View file @
05db60e
import
utils.CalEnv
;
import
utils.Point
;
import
utils.TianDiTuTiledMapServiceType
;
...
...
src/TiandituDownload.java
View file @
05db60e
...
...
@@ -20,7 +20,7 @@ public class TiandituDownload {
int
[]
level
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
};
// 分辨率
double
[]
res
=
{
double
[]
res
4490
=
{
1.40625
,
0.703125
,
0.3515625
,
...
...
@@ -44,7 +44,7 @@ public class TiandituDownload {
1.34110450744629
E
-
06
};
// 比例尺
double
[]
scale
=
{
double
[]
scale
4490
=
{
400000000
,
295497598.5708346
,
147748799.285417
,
...
...
@@ -67,6 +67,47 @@ public class TiandituDownload {
1127.2338812669175
,
563.61694063345875
};
double
[]
scale3857
=
{
295829355.45
,
147914677.73
,
73957338.86
,
36978669.43
,
18489334.72
,
9244667.36
,
4622333.68
,
2311166.84
,
1155583.42
,
577791.71
,
288895.85
,
144447.93
,
72223.96
,
36111.98
,
18055.99
,
9028
,
4514
,
2257
};
double
[]
res3857
=
{
0.70391441567318025
,
0.35195720784848739
,
0.1759786039123464
,
0.087989301956173202
,
0.043994650989983904
,
0.021997325494991952
,
0.010998662747495976
,
0.005499331373747988
,
0.002749665686873994
,
0.001374832843436997
,
0.00068741640982119352
,
0.00034370821680790179
,
0.00017185409650664589
,
8.5927048253322947
e
-
005
,
4.2963524126661473
e
-
005
,
2.1481773960635764
e
-
005
,
1.0740886980317882
e
-
005
,
5.3704434901589409
e
-
006
};
// 最小级别
int
minLevel
=
1
;
...
...
@@ -80,19 +121,22 @@ public class TiandituDownload {
Connection
conn
=
null
;
Statement
stmt
=
null
;
public
TiandituDownload
()
{
}
public
TiandituDownload
(
String
dbpath
)
{
this
.
dbpath
=
dbpath
;
}
/**
*
* @param originPoint 坐标点
* @param level 级别
* @return 改点在该级别所属的地图瓦片行列号
* @return 改点在该级别所属的地图瓦片行列号
(4490)
*/
private
CalEnv
calculateEnv
(
Point
originPoint
,
int
level
)
{
int
startX
=
(
int
)
Math
.
floor
((
originPoint
.
getLng
()
+
180
)
/
(
256
*
res
[
level
]));
int
startY
=
(
int
)
Math
.
floor
((
90
-
originPoint
.
getLat
())
/
(
256
*
res
[
level
]));
private
CalEnv
calculateEnv
4490
(
Point
originPoint
,
int
level
)
{
int
startX
=
(
int
)
Math
.
floor
((
originPoint
.
getLng
()
+
180
)
/
(
256
*
res
4490
[
level
]));
int
startY
=
(
int
)
Math
.
floor
((
90
-
originPoint
.
getLat
())
/
(
256
*
res
4490
[
level
]));
if
(
startX
<
0
)
startX
=
0
;
if
(
startY
<
0
)
startY
=
0
;
...
...
@@ -100,7 +144,6 @@ public class TiandituDownload {
}
/**
*
* @param minPoint 下载范围左下角坐标
* @param maxPoint 下载范围右上角坐标
* @param level 下载级别
...
...
@@ -110,8 +153,8 @@ public class TiandituDownload {
private
void
downloadSingLevelTiles
(
Point
minPoint
,
Point
maxPoint
,
int
level
,
TianDiTuTiledMapServiceType
type
,
boolean
merge
)
{
try
{
CalEnv
startEnv
=
calculateEnv
(
minPoint
,
level
);
CalEnv
stopEnv
=
calculateEnv
(
maxPoint
,
level
);
CalEnv
startEnv
=
calculateEnv
4490
(
minPoint
,
level
);
CalEnv
stopEnv
=
calculateEnv
4490
(
maxPoint
,
level
);
PreparedStatement
preparedStatement
;
ResultSet
rs
;
...
...
@@ -179,7 +222,6 @@ public class TiandituDownload {
}
/**
*
* @param minPoint 下载范围左下角坐标
* @param maxPoint 下载范围右上角坐标
* @param minLevel 下载最小级别
...
...
@@ -216,6 +258,7 @@ public class TiandituDownload {
/**
* 下载网络数据
*
* @param url
* @return 图片数据流
* @throws Exception
...
...
Please
register
or
sign in
to post a comment