Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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
Elphel
x3domlet
Commits
48e79eec
Commit
48e79eec
authored
Jul 17, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added mapbox layers
parent
3498a812
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
8 deletions
+57
-8
leaflet_init.js
js/leaflet_init.js
+57
-8
No files found.
js/leaflet_init.js
View file @
48e79eec
...
...
@@ -40,6 +40,8 @@
// http://leafletjs.com/examples/extending/extending-1-classes.html
// - extend or include
var
mbxtoken
=
""
;
var
LeafletObject
=
function
(
id
,
data
,
options
){
var
defaults
=
{
...
...
@@ -61,7 +63,19 @@ var LeafletObject = function(id,data,options){
this
.
fov
=
data
.
camera
.
fov
;
this
.
initialize
();
//this.initialize();
var
self
=
this
;
$
.
ajax
({
url
:
"mapbox_token.txt"
,
success
:
function
(
token
){
mbxtoken
=
token
;
self
.
initialize
();
},
error
:
function
(
response
){
self
.
initialize
();
}
});
};
...
...
@@ -92,16 +106,51 @@ LeafletObject.prototype.initialize = function(){
}
);
var
mapboxattr
=
'<a href="https://www.mapbox.com/about/maps/" target="_blank">© Mapbox</a> <a href="https://openstreetmap.org/about/" target="_blank">© OpenStreetMap</a>'
;
var
mbxurl1
=
"https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}@2x.png?access_token="
+
mbxtoken
;
var
mbxurl2
=
"https://api.mapbox.com/v4/mapbox.pencil/{z}/{x}/{y}@2x.png?access_token="
+
mbxtoken
;
var
MBXTiles1
=
L
.
tileLayer
(
mbxurl1
,
{
maxZoom
:
this
.
_settings
.
maxzoom
,
attribution
:
mapboxattr
}
);
var
MBXTiles2
=
L
.
tileLayer
(
mbxurl2
,
{
maxZoom
:
this
.
_settings
.
maxzoom
,
attribution
:
mapboxattr
}
);
if
(
mbxtoken
==
""
){
selected_layer
=
googleSat
;
var
baseMaps
=
{
"Esri world imagery"
:
Esri_WorldImagery
,
"Google"
:
googleSat
,
"Open Street Map"
:
OSMTiles
};
}
else
{
selected_layer
=
MBXTiles1
;
var
baseMaps
=
{
"Mapbox 1"
:
MBXTiles1
,
"Mapbox 2"
:
MBXTiles2
,
"Esri world imagery"
:
Esri_WorldImagery
,
"Google"
:
googleSat
,
"Open Street Map"
:
OSMTiles
};
}
this
.
_map
=
L
.
map
(
this
.
_id
,{
layers
:[
googleSat
]
layers
:[
selected_layer
]
}).
setView
(
this
.
center
,
this
.
_settings
.
zoom
);
var
baseMaps
=
{
"Esri world imagery"
:
Esri_WorldImagery
,
"Google"
:
googleSat
,
"Open Street Map"
:
OSMTiles
};
L
.
control
.
layers
(
baseMaps
).
addTo
(
this
.
_map
);
this
.
drawCamera
();
...
...
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