Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2XB3FinalProject
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Schankula
2XB3FinalProject
Commits
a01b15e5
Commit
a01b15e5
authored
6 years ago
by
Ray Liu
Browse files
Options
Downloads
Patches
Plain Diff
Finished heat maps api
parent
0788de7f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tomcat/webapps/Trawl/map.js
+64
-0
64 additions, 0 deletions
tomcat/webapps/Trawl/map.js
tomcat/webapps/Trawl/map.jsp
+47
-0
47 additions, 0 deletions
tomcat/webapps/Trawl/map.jsp
with
111 additions
and
0 deletions
tomcat/webapps/Trawl/map.js
0 → 100644
+
64
−
0
View file @
a01b15e5
//*This code references the google heat maps API
// This example requires the Visualization library. Include the libraries=visualization
// parameter when you first load the API. For example:
// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=visualization">
var
map
,
heatmap
;
function
initMap
(
longi
,
lati
)
{
map
=
new
google
.
maps
.
Map
(
document
.
getElementById
(
'
map
'
),
{
zoom
:
13
,
center
:
{
lat
:
37.775
,
lng
:
-
122.434
},
mapTypeId
:
'
satellite
'
});
heatmap
=
new
google
.
maps
.
visualization
.
HeatmapLayer
({
data
:
getPoints
(
longi
,
lati
),
map
:
map
});
}
function
toggleHeatmap
()
{
heatmap
.
setMap
(
heatmap
.
getMap
()
?
null
:
map
);
}
function
changeGradient
()
{
var
gradient
=
[
‘
rgba
(
0
,
255
,
255
,
0
)
’
,
‘
rgba
(
0
,
255
,
255
,
1
)
’
,
‘
rgba
(
0
,
191
,
255
,
1
)
’
,
‘
rgba
(
0
,
127
,
255
,
1
)
’
,
‘
rgba
(
0
,
63
,
255
,
1
)
’
,
‘
rgba
(
0
,
0
,
255
,
1
)
’
,
‘
rgba
(
0
,
0
,
223
,
1
)
’
,
‘
rgba
(
0
,
0
,
191
,
1
)
’
,
‘
rgba
(
0
,
0
,
159
,
1
)
’
,
‘
rgba
(
0
,
0
,
127
,
1
)
’
,
‘
rgba
(
0
,
63
,
91
,
1
)
’
,
‘
rgba
(
0
,
127
,
63
,
1
)
’
,
‘
rgba
(
0
,
191
,
10
,
1
)
’
,
‘
rgba
(
0
,
255
,
0
,
1
)
’
]
heatmap
.
set
(
'
gradient
'
,
heatmap
.
get
(
'
gradient
'
)
?
null
:
gradient
);
}
function
changeRadius
()
{
heatmap
.
set
(
'
radius
'
,
heatmap
.
get
(
'
radius
'
)
?
null
:
20
);
}
function
changeOpacity
()
{
heatmap
.
set
(
'
opacity
'
,
heatmap
.
get
(
'
opacity
'
)
?
null
:
0.2
);
}
// Heatmap data
function
getPoints
(
latitude
,
longitude
)
{
var
result
=
[];
for
(
int
i
=
0
;
i
<
latitude
.
length
;
i
++
)
{
result
.
push
(
new
google
.
maps
.
LatLng
(
latitude
[
i
],
longitude
[
i
]));
}
return
result
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tomcat/webapps/Trawl/map.jsp
0 → 100644
+
47
−
0
View file @
a01b15e5
<%@ page
import=
"java.util.*, data.Record, model.TrawlExpert, search.BST, search.BasicSearchResult,data.BioTree,data.TaxonNode"
%>
<%@page
import=
"org.json.simple.JSONArray"
%>
<%@page
import=
"org.json.simple.JSONObject"
%>
<%@page
import=
"org.json.simple.parser.JSONParser"
%>
<%
TrawlExpert
te
=
(
TrawlExpert
)
request
.
getServletContext
().
getAttribute
(
"trawl"
);
BasicSearchResult
result
=
te
.
rangeSearch
(
2
,
1960
,
2016
);
JSONParser
parser
=
new
JSONParser
();
JSONObject
js
=
new
JSONObject
();
JSONArray
longitude
=
new
JSONArray
();
JSONArray
latitude
=
new
JSONArray
();
JSONArray
name
=
new
JSONArray
();
JSONArray
date
=
new
JSONArray
();
JSONArray
count
=
new
JSONArray
();
for
(
Record
r:
result
.
results
()){
longitude
.
add
(
r
.
getLongitude
());
latitude
.
add
(
r
.
getLatitude
());
name
.
add
(
BioTree
.
getTaxonRecord
(
r
.
getTaxonId
()).
getName
());
JSONObject
dateobj
=
new
JSONObject
();
dateobj
.
put
(
"year"
,
r
.
getDate
().
getYear
());
dateobj
.
put
(
"month"
,
r
.
getDate
().
getMonth
());
dateobj
.
put
(
"day"
,
r
.
getDate
().
getDay
());
date
.
add
(
r
.
getDate
());
count
.
add
(
r
.
getCount
());
}
js
.
put
(
"longitude"
,
longitude
);
js
.
put
(
"latitude"
,
latitude
);
js
.
put
(
"name"
,
name
);
js
.
put
(
"date"
,
date
);
js
.
put
(
"individual count"
,
count
);
js
.
put
(
"time"
,
result
.
time
());
out
.
print
(
js
.
toJSONString
());
%>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment