Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
3d392662
Commit
3d392662
authored
6 years ago
by
Esko Ikkala
Browse files
Options
Downloads
Patches
Plain Diff
Add google maps baselayers
parent
27ed9394
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/LeafletMap.js
+27
-6
27 additions, 6 deletions
src/components/LeafletMap.js
with
27 additions
and
6 deletions
src/components/LeafletMap.js
+
27
−
6
View file @
3d392662
...
@@ -12,14 +12,23 @@ import 'react-leaflet-fullscreen/dist/styles.css';
...
@@ -12,14 +12,23 @@ import 'react-leaflet-fullscreen/dist/styles.css';
import
'
react-leaflet-markercluster/dist/styles.min.css
'
;
import
'
react-leaflet-markercluster/dist/styles.min.css
'
;
import
SimpleSlider
from
'
./SimpleSlider
'
;
import
SimpleSlider
from
'
./SimpleSlider
'
;
import
Control
from
'
react-leaflet-control
'
;
import
Control
from
'
react-leaflet-control
'
;
import
{
GoogleLayer
}
from
'
react-leaflet-google
'
;
// https://console.developers.google.com/apis/credentials?project=hipla-187309
const
key
=
'
AIzaSyCKWw5FjhwLsfp_l2gjVAifPkT3cxGXhA4
'
;
const
road
=
'
ROADMAP
'
;
// displays the default road map view. This is the default map type.
const
satellite
=
'
SATELLITE
'
;
// displays Google Earth satellite images.
const
hybrid
=
'
HYBRID
'
;
// displays a mixture of normal and satellite views.
const
terrain
=
'
TERRAIN
'
;
// displays a physical map based on terrain information.
class
LeafletMap
extends
React
.
Component
{
class
LeafletMap
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
lat
:
6
4.950916
,
lat
:
6
3.78248603116502
,
lng
:
27.095982
,
lng
:
40.10009765625001
,
zoom
:
5
,
zoom
:
5
,
opacity
:
1.0
opacity
:
1.0
};
};
...
@@ -31,13 +40,26 @@ class LeafletMap extends React.Component {
...
@@ -31,13 +40,26 @@ class LeafletMap extends React.Component {
render
()
{
render
()
{
const
position
=
[
this
.
state
.
lat
,
this
.
state
.
lng
];
const
position
=
[
this
.
state
.
lat
,
this
.
state
.
lng
];
return
(
return
(
<
Map
<
Map
center
=
{
position
}
center
=
{
position
}
zoom
=
{
this
.
state
.
zoom
}
>
zoom
=
{
this
.
state
.
zoom
}
>
<
LayersControl
position
=
"
topright
"
>
<
LayersControl
position
=
"
topright
"
>
<
LayersControl
.
BaseLayer
checked
name
=
"
OpenStreetMap
"
>
<
LayersControl
.
BaseLayer
checked
name
=
'
Google Maps Roads
'
>
<
GoogleLayer
googlekey
=
{
key
}
maptype
=
{
road
}
/
>
<
/LayersControl.BaseLayer
>
<
LayersControl
.
BaseLayer
name
=
'
Google Maps Satellite
'
>
<
GoogleLayer
googlekey
=
{
key
}
maptype
=
{
satellite
}
/
>
<
/LayersControl.BaseLayer
>
<
LayersControl
.
BaseLayer
name
=
'
Google Maps Hybrid
'
>
<
GoogleLayer
googlekey
=
{
key
}
maptype
=
{
hybrid
}
/
>
<
/LayersControl.BaseLayer
>
<
LayersControl
.
BaseLayer
name
=
'
Google Maps Terrain
'
>
<
GoogleLayer
googlekey
=
{
key
}
maptype
=
{
terrain
}
/
>
<
/LayersControl.BaseLayer
>
<
LayersControl
.
BaseLayer
name
=
"
OpenStreetMap
"
>
<
TileLayer
<
TileLayer
attribution
=
"
&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
"
attribution
=
"
&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
"
url
=
"
https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
"
url
=
"
https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
"
...
@@ -57,7 +79,6 @@ class LeafletMap extends React.Component {
...
@@ -57,7 +79,6 @@ class LeafletMap extends React.Component {
opacity
=
{
this
.
state
.
opacity
}
opacity
=
{
this
.
state
.
opacity
}
/
>
/
>
<
/LayersControl.Overlay
>
<
/LayersControl.Overlay
>
<
/LayersControl
>
<
/LayersControl
>
<
MarkerClusterGroup
>
<
MarkerClusterGroup
>
<
ResultMarkerList
results
=
{
this
.
props
.
results
}
/
>
<
ResultMarkerList
results
=
{
this
.
props
.
results
}
/
>
...
...
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