Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
map-parent
Commits
f97a68dd
Commit
f97a68dd
authored
Feb 08, 2023
by
yangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轨迹相似度调整提交(标准)
parent
68ef61a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
common/common_utils/src/main/java/com/founder/commonutils/util/map/LCSS.java
+16
-12
No files found.
common/common_utils/src/main/java/com/founder/commonutils/util/map/LCSS.java
View file @
f97a68dd
...
...
@@ -15,7 +15,7 @@ public class LCSS {
}
public
boolean
isNearby
(
Coordinate
a
,
Coordinate
b
,
int
radius
)
{
if
(
getDistance
(
a
,
b
)
<
radius
)
return
true
;
if
(
getDistance
(
a
.
getX
(),
a
.
getY
(),
b
.
getX
(),
b
.
getY
())
<
radius
)
return
true
;
return
false
;
}
...
...
@@ -74,16 +74,19 @@ public class LCSS {
//归一化处理
return
map
;
}
public
static
void
main
(
String
[]
args
)
{
List
<
Coordinate
>
l1
=
new
ArrayList
<>();
l1
.
add
(
new
Coordinate
(
114.300
,
30.1
,
"1647927276000"
));
l1
.
add
(
new
Coordinate
(
114.302
,
30.101
,
"1648048592000"
));
List
<
Coordinate
>
l2
=
new
ArrayList
<>();
l2
.
add
(
new
Coordinate
(
109.304
,
30.1003
,
"1648048572000"
));
l2
.
add
(
new
Coordinate
(
109.302
,
30.101
,
"1648048545000"
));
LCSS
lcss
=
new
LCSS
();
System
.
out
.
println
(
lcss
.
lcs
(
l1
,
l2
,
10
,
1
));
private
static
double
EARTH_RADIUS
=
6371.393
;
private
static
double
rad
(
double
d
)
{
return
d
*
Math
.
PI
/
180.0
;
}
public
static
double
getDistance
(
double
lat1
,
double
lng1
,
double
lat2
,
double
lng2
)
{
double
radLat1
=
rad
(
lat1
);
double
radLat2
=
rad
(
lat2
);
double
a
=
radLat1
-
radLat2
;
double
b
=
rad
(
lng1
)
-
rad
(
lng2
);
double
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
abs
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)
*
Math
.
cos
(
radLat2
)
*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
))));
s
=
s
*
EARTH_RADIUS
;
s
=
Math
.
round
(
s
*
1000
);
return
s
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment