Retroscope를 만들자.

7772 단어 foss4gleaflet

소개



이것은 State of the Map Japan 2018 의 강연에서 사용한 샘플 코드 두는 장소입니다.

1. OpenStreetMap을 보자.



이 코드는

a.html
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>hello leaflet</title>
  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
  <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
  <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
</head>

<body>
  <div id="map" style="position:absolute;top:0;left:0;bottom:0;right:0;"></div>
  <script>
    var map = L.map("map").setView([35.671872, 139.754969], 18);
    L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
      attribution: "&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a>contributors"
    }).addTo(map);
  </script>
</body>

</html>

이렇게



2. Retroscope를 보자.



이 코드는

b.html
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>retroscope</title>
  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
  <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
  <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
  <script src="https://frogcat.github.io/leaflet-tilelayer-mask/leaflet-tilelayer-mask.js"></script>
</head>

<body>
  <div id="map" style="position:absolute;top:0;left:0;bottom:0;right:0;"></div>
  <script>
    var map = L.map("map").setView([35.671872, 139.754969], 18);
    L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
      attribution: "&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors"
    }).addTo(map);

    var layer = L.tileLayer.mask("https://cyberjapandata.gsi.go.jp/xyz/seamlessphoto/{z}/{x}/{y}.jpg", {
      attribution: "<a href='http://maps.gsi.go.jp/development/ichiran.html'>地理院タイル</a>"
    }).addTo(map);

    map.on("mousemove", function(event) {
      layer.setCenter(event.containerPoint);
    });
  </script>
</body>

</html>


이렇게

좋은 웹페이지 즐겨찾기