FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
google-map-react-examples/src/examples/Heatmap.js at master · google-map-react/google-map-react-examples · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
google-map-react
/
google-map-react-examples
Public
Notifications
You must be signed in to change notification settings
Fork
145
Star
144
Code
Issues
0
Pull requests
15
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
google-map-react-examples
/
src
/
examples
/
Heatmap.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (50 loc) · 1.22 KB
Breadcrumbs
google-map-react-examples
/
src
/
examples
/
Heatmap.js
Copy path
File metadata and controls
58 lines (50 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import
React
,
{
Component
}
from
'react'
;
import
isEmpty
from
'lodash.isempty'
;
// examples:
import
GoogleMap
from
'../components/GoogleMap'
;
// consts
import
LOS_ANGELES_CENTER
from
'../const/la_center'
;
class
Heatmap
extends
Component
{
constructor
(
props
)
{
super
(
props
)
;
this
.
state
=
{
places
:
[
]
,
}
;
}
componentDidMount
(
)
{
fetch
(
'places.json'
)
.
then
(
(
response
)
=>
response
.
json
(
)
)
.
then
(
(
data
)
=>
this
.
setState
(
{
places
:
data
.
results
}
)
)
;
}
render
(
)
{
const
{
places
}
=
this
.
state
;
const
data
=
places
.
map
(
(
place
)
=>
(
{
lat
:
place
.
geometry
.
location
.
lat
,
lng
:
place
.
geometry
.
location
.
lng
,
weight
:
Math
.
floor
(
Math
.
random
(
)
*
Math
.
floor
(
5
)
)
,
}
)
)
;
const
heatmapData
=
{
positions
:
data
,
options
:
{
radius
:
20
,
opacity
:
1
,
}
,
}
;
return
(
<
>
{
!
isEmpty
(
places
)
&&
(
<
GoogleMap
defaultZoom
=
{
10
}
defaultCenter
=
{
LOS_ANGELES_CENTER
}
heatmap
=
{
heatmapData
}
bootstrapURLKeys
=
{
{
key
:
process
.
env
.
REACT_APP_MAP_KEY
,
libraries
:
[
'visualization'
]
,
}
}
/>
)
}
</
>
)
;
}
}
export
default
Heatmap
;
Back
|
FazBrowse Home
|
New Git URL