remove mapbox
add div icon that use svg directly
This commit is contained in:
parent
2b46f6d16a
commit
6cf17f80d7
@ -1,3 +1,2 @@
|
|||||||
[js/nav.js]
|
[js/nav.js]
|
||||||
your_api_key=abc
|
|
||||||
start_location=50.7, 7.2
|
start_location=50.7, 7.2
|
@ -22,10 +22,11 @@ function parsedata() {
|
|||||||
if (markeritem['Icon'] === null) {
|
if (markeritem['Icon'] === null) {
|
||||||
marker = L.marker([markeritem['Latitude'], markeritem['Longitude']], { 'title': markeritem['Name'] });
|
marker = L.marker([markeritem['Latitude'], markeritem['Longitude']], { 'title': markeritem['Name'] });
|
||||||
} else {
|
} else {
|
||||||
var myIcon = L.icon({
|
var myIcon = L.divIcon({
|
||||||
'iconUrl': markeritem['Icon'],
|
className: 'pos-marker',
|
||||||
'iconSize': [56, 80],
|
iconSize: [56, 80],
|
||||||
'iconAnchor': [0, 80]
|
iconAnchor: [0, 80],
|
||||||
|
html: '<object data="'+markeritem['Icon']+'" type="image/svg+xml" style="height:80px; width:56px;"></object>'
|
||||||
});
|
});
|
||||||
marker = L.marker([markeritem['Latitude'], markeritem['Longitude']], { 'title': markeritem['Name'], 'icon': myIcon });
|
marker = L.marker([markeritem['Latitude'], markeritem['Longitude']], { 'title': markeritem['Name'], 'icon': myIcon });
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
var mymap = L.map('bigmap').setView(["{%START_LOCATION%}"], 14);
|
var mymap = L.map('bigmap').setView(["{%START_LOCATION%}"], 14);
|
||||||
|
|
||||||
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
maxZoom: 20,
|
|
||||||
id: 'mapbox.streets',
|
|
||||||
accessToken: '"{%YOUR_API_KEY%}"'
|
|
||||||
}).addTo(mymap);
|
}).addTo(mymap);
|
||||||
|
|
||||||
mymap.on("click", hidePanel);
|
mymap.on("click", hidePanel);
|
||||||
|
Loading…
Reference in New Issue
Block a user