Sie sind hier : sebastian1012.bplaced.net/ homepage-neu / Kurze-Scripte-und-Codeschnipsel / index.php

Zurück


Der Quellcode dazu


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
59
60
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Leaflet Routing Machine Example</title>
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css" />
    <link rel="stylesheet" href="https://unpkg.com/leaflet-routing-machine@latest/dist/leaflet-routing-machine.css" />
    <script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"></script>
    <script src="https://unpkg.com/leaflet-routing-machine@latest/dist/leaflet-routing-machine.js"></script>
  <style>
    #map{
  height:500px;
}
  </style>
</head>
<body>
    <div id="map" class="map">
        <style>
            #map{
                height: 500px;
            }
            .map{
                height: 500px;
            }
        </style>
    </div>
 
  <script>
    
    /*var mymap = L.map('map').setView([10.0377,105.7813], 13);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
  attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
  maxZoom: 18,
  id: 'mapbox.streets',
  accessToken: 'pk.eyJ1IjoidGhhaXBodWMiLCJhIjoiY2ptcnJ4enp0MXh5cTNrazQxeDZiM2JidyJ9.BTPswkG7tgmqf9Gpx_pLnQ'
}).addTo(mymap);
L.Routing.control({
  waypoints: [
    L.latLng(10.050093, 105.771378),
    L.latLng(10.05048, 105.773025)
  ],
  routeWhileDragging: true
}).addTo(mymap);*/
/*var marker = L.marker([10.0377,105.7813]).addTo(mymap);
marker.bindPopup("<b>Hello world!</b><br>I am a popup.").openPopup();*/
var map = L.map('map').setView([53.900,8.900], 14);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}{r}.png', {
    attribution: '© OpenStreetMap contributors'
}).addTo(map);
L.Routing.control({
    waypoints: [
        L.latLng(53.900, 8.900),
        L.latLng(53.800, 8.800)
    ],
    routeWhileDragging: true
}).addTo(map);
    
  </script>
</body>
</html>