Advertisement
Guest User

Untitled

a guest
Jul 10th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.56 KB | None | 0 0
  1. <!doctype html>
  2.  
  3. <!--
  4.  Copyright (C) 2011-2012 Pavel Shramov
  5.  Copyright (C) 2013 Maxime Petazzoni <maxime.petazzoni@bulix.org>
  6.  All Rights Reserved.
  7.  
  8.  Redistribution and use in source and binary forms, with or without
  9.  modification, are permitted provided that the following conditions are met:
  10.  
  11.  - Redistributions of source code must retain the above copyright notice,
  12.    this list of conditions and the following disclaimer.
  13.  
  14.  - Redistributions in binary form must reproduce the above copyright notice,
  15.    this list of conditions and the following disclaimer in the documentation
  16.    and/or other materials provided with the distribution.
  17.  
  18.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19.  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20.  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21.  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  22.  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23.  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24.  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25.  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26.  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27.  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28.  POSSIBILITY OF SUCH DAMAGE.
  29. -->
  30.  
  31. <html>
  32.   <head>
  33.     <title>leaflet-gpx demo</title>
  34.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" />
  35.     <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
  36.     <script src="https://rawgithub.com/mpetazzoni/leaflet-gpx/master/gpx.js"></script>
  37.     <style type="text/css">
  38.       #demo-map {
  39.         width: 500px;
  40.         height: 500px;
  41.       }
  42.     </style>
  43.   </head>
  44.   <body>
  45.    
  46.     <div class="map" id="demo-map"></div>
  47.    
  48.  
  49.  
  50.     <script type="application/javascript">
  51.  
  52.         var map = L.map("demo-map").setView([50.42, 9.62], 10);
  53.        
  54.         var osmBase = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
  55.           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>'
  56.         });
  57.  
  58.        
  59.  
  60.         var mo = {
  61.             startIconUrl: 'http://github.com/mpetazzoni/leaflet-gpx/raw/master/pin-icon-start.png',
  62.             endIconUrl:   'http://github.com/mpetazzoni/leaflet-gpx/raw/master/pin-icon-end.png',
  63.             shadowUrl:    'http://github.com/mpetazzoni/leaflet-gpx/raw/master/pin-shadow.png',
  64.           };
  65.  
  66.         // ein GPX-Layer
  67.         var gpx1 = new L.GPX("/w1.gpx", {
  68.           async: true,
  69.           marker_options: mo
  70.         });
  71.        
  72.         // noch eins
  73.         var gpx2 = new L.GPX("/w2.gpx", {
  74.           async: true,
  75.           marker_options: mo
  76.         });
  77.        
  78.         // und ein drittes
  79.         var gpx3 = new L.GPX("/w3.gpx", {
  80.           async: true,
  81.           marker_options: mo
  82.         });
  83.        
  84.         // Layergruppe, in die die 3 GPX-Layer zusammengefasst werden
  85.         var lg = new L.LayerGroup([gpx1, gpx2, gpx3]);
  86.        
  87.         /*
  88.         so geht es auch:
  89.         lg.addLayer(gpx1);
  90.         lg.addLayer(gpx2);
  91.         lg.addLayer(gpx3);
  92.         */
  93.        
  94.         var control = L.control.layers({"OSM": osmBase}, {"3 Tracks": lg}).addTo(map);
  95.  
  96.         /*
  97.         Langform für die Overlays:
  98.         control.addOverlay(gpx1, "Track 1");
  99.         control.addOverlay(gpx2, "Track 2");
  100.         control.addOverlay(gpx3, "Track 3");
  101.         control.addOverlay(lg, "Alle zusammen");
  102.         */
  103.      
  104.     </script>
  105.   </body>
  106. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement