remove mapbox

add div icon that use svg directly
This commit is contained in:
BlubbFish 2019-03-14 19:32:05 +01:00
parent 2b46f6d16a
commit 6cf17f80d7
3 changed files with 7 additions and 10 deletions

View File

@ -1,3 +1,2 @@
[js/nav.js]
your_api_key=abc
start_location=50.7, 7.2

View File

@ -22,10 +22,11 @@ function parsedata() {
if (markeritem['Icon'] === null) {
marker = L.marker([markeritem['Latitude'], markeritem['Longitude']], { 'title': markeritem['Name'] });
} else {
var myIcon = L.icon({
'iconUrl': markeritem['Icon'],
'iconSize': [56, 80],
'iconAnchor': [0, 80]
var myIcon = L.divIcon({
className: 'pos-marker',
iconSize: [56, 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 });
}

View File

@ -1,10 +1,7 @@
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}', {
attribution: 'Map data &copy; <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>',
maxZoom: 20,
id: 'mapbox.streets',
accessToken: '"{%YOUR_API_KEY%}"'
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(mymap);
mymap.on("click", hidePanel);