{"id":4200,"date":"2015-04-11T11:15:28","date_gmt":"2015-04-11T02:15:28","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=4200"},"modified":"2015-04-11T22:01:35","modified_gmt":"2015-04-11T13:01:35","slug":"post-4200","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/leaflet-js\/4200","title":{"rendered":"\u6226\u5f8c\u30fb\u5fa9\u8208\u671f\u3068\u73fe\u5728\u306e\u7a7a\u4e2d\u5199\u771f\u3092\u91cd\u306d\u3066\u6bd4\u8f03\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p><a href=\"https:\/\/gunmagisgeek.com\/blog\/leaflet-js\/4197\">\u6628\u65e5<\/a>\u306e\u7d9a\u304d\u3002<\/p>\n<p><a href=\"http:\/\/shimz.me\/datavis\/japan\/tokyo1945-2007\/slide.html\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletclipexample150411.jpg\" alt=\"leaflet clip example\" width=\"690\" height=\"453\" class=\"aligncenter size-full wp-image-4201\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletclipexample150411.jpg 690w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2015\/04\/leafletclipexample150411-228x150.jpg 228w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/shimz.me\/datavis\/japan\/tokyo1945-2007\/slide.html\">example<\/a><\/p>\n<p>Facebook\u306b\u3066\u3001<a href=\"https:\/\/www.facebook.com\/GunmaGisGeek\/posts\/790113601084992\">\u30ec\u30a4\u30e4\u30fc\u3092\u91cd\u306d\u3066\u6bd4\u8f03\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/a>\u3092\u6559\u3048\u3066\u3044\u305f\u3060\u3044\u305f\u306e\u3067\u3001\u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u30b5\u30f3\u30d7\u30eb\u3092\u3061\u3087\u3063\u3068\u5f04\u3063\u305f\u3060\u3051\u3067\u3059\u304c\u3001\u4e00\u5fdcY\u8ef8\u306b\u3082\u30b9\u30e9\u30a4\u30c9\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u4e0a\u306e\u30b9\u30e9\u30a4\u30c0\u30fc\u3092\u52d5\u304b\u3059\u3068Y\u8ef8\u304c\u3001\u4e0b\u306e\u30b9\u30e9\u30a4\u30c0\u30fc\u3092\u52d5\u304b\u3059\u3068X\u8ef8\u306e\u8868\u793a\u9818\u57df\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<p>\u91cd\u306d\u305f\u30ec\u30a4\u30e4\u30fc\u3092css\u306eclip\u6a5f\u80fd\u3067\u5207\u308a\u629c\u3044\u3066\u8868\u793a\u30fb\u975e\u8868\u793a\u3092\u64cd\u4f5c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<pre class=\"lang:js decode:true \" >var ort = L.tileLayer(\r\n  'http:\/\/cyberjapandata.gsi.go.jp\/xyz\/ort\/{z}\/{x}\/{y}.jpg', {\r\n    attribution: \"GSI Ortho\", maxNativeZoom: 17, maxZoom: 20\r\n});\r\n\r\nvar ort1940 = L.tileLayer(\r\n  'http:\/\/cyberjapandata.gsi.go.jp\/xyz\/ort_USA10\/{z}\/{x}\/{y}.png', {\r\n    attribution: \"GSI Ortho 1940s\", maxNativeZoom: 17, maxZoom: 20\r\n});\r\n\r\nvar std = L.tileLayer(\r\n\t'http:\/\/cyberjapandata.gsi.go.jp\/xyz\/std\/{z}\/{x}\/{y}.png',\r\n\t{\r\n\t    attribution: \"GSI Std\", maxNativeZoom: 17, maxZoom: 20\r\n\t}\r\n);\r\n\r\nvar map = L.map('mapdiv', {\r\n\tcenter: [35.6768, 139.7218],\r\n\tzoom: 16,\r\n\tlayers: [ort, std , ort1940],\r\n\tzoomControl: false\r\n});\r\n\r\nnew L.Control.Zoom({ position: 'bottomright' }).addTo(map);\r\nvar hash = L.hash(map);\r\n\r\nvar rangeX = document.querySelector('.rangeX');\r\nvar rangeY = document.querySelector('.rangeY');\r\n\r\nfunction clip() {\r\n\tvar nw = map.containerPointToLayerPoint([0, 0]);\t\/\/\u30ec\u30a4\u30e4\u30fc\u30b3\u30f3\u30c6\u30ca\u5de6\u4e0a\u5ea7\u6a19(North West)\r\n\tvar se = map.containerPointToLayerPoint(map.getSize());\t\/\/\u30ec\u30a4\u30e4\u30fc\u30b3\u30f3\u30c6\u30ca\u53f3\u4e0b\u5ea7\u6a19(South East)\r\n\r\n\r\n\tvar clipX = nw.x + (se.x - nw.x) * rangeX.value;\t\/\/x\u8ef8\u53f3\u5ea7\u6a19( * 0.5 \u3067x\u8ef8\u4e2d\u5fc3\u5ea7\u6a19)\r\n\tvar clipY = nw.y + (se.y - nw.y) * rangeY.value; \t\/\/y\u8ef8\u4e0b\u5ea7\u6a19\r\n\t  \r\n\t\/\/css clip\u3092\u30ec\u30a4\u30e4\u30fc\u30b3\u30f3\u30c6\u30ca\u306b\u9069\u7528\u3059\u308b rect\uff08\u4e0a,\u53f3,\u4e0b,\u5de6\uff09\r\n\tstd.getContainer().style.clip = 'rect(' + [nw.y, clipX, clipY, nw.x].join('px,') + 'px)';\r\n\tort1940.getContainer().style.clip = 'rect(' + [clipY, clipX, se.y, nw.x].join('px,') + 'px)';\r\n}\r\n\r\n\r\n\/\/\u4e09\u9805\u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u3066oninput\u304c\u5b58\u5728\u3059\u308b\u304b\u8abf\u3079\u3066\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u3092\u8a2d\u5b9a\u3057\u3066\u308b\r\nrangeX['oninput' in rangeX ? 'oninput' : 'onchange'] = clip;\r\nrangeY['oninput' in rangeY ? 'oninput' : 'onchange'] = clip;\r\n\r\nmap.on('move', clip);\r\n\r\nclip();<\/pre>\n<h2>\u30d6\u30e9\u30a6\u30b6\u9593\u306e\u9055\u3044\u3092\u5438\u53ce\u3059\u308b<\/h2>\n<p>\u30d6\u30e9\u30a6\u30b6\u306b\u3088\u3063\u3066\u3001\u4f7f\u3048\u308b\u30e1\u30bd\u30c3\u30c9\u3084\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u9055\u3046\u306e\u3067\u3059\u304c\u3001\u4e09\u9805\u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u3066\u5206\u5c90\u3055\u305b\u308b\u65b9\u6cd5\u3092\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u521d\u3081\u3066\u77e5\u308a\u307e\u3057\u305f\u3002\u3053\u308c\u4fbf\u5229\u3067\u3059\u306d\u3002<\/p>\n<pre class=\"lang:js decode:true \" >rangeX['oninput' in rangeX ? 'oninput' : 'onchange'] = clip;<\/pre>\n<p><a href=\"http:\/\/qiita.com\/_shimizu\/items\/913c804f25d2a5b035dd\">JavaScript &#8211; \u30d6\u30e9\u30a6\u30b6\u9593\u306e\u30e1\u30bd\u30c3\u30c9\u3084\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u9055\u3044\u3092\u4e09\u9805\u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u3066\u5438\u53ce\u3059\u308b &#8211; Qiita<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6628\u65e5\u306e\u7d9a\u304d\u3002 example Facebook\u306b\u3066&hellip;<\/p>\n","protected":false},"author":1,"featured_media":4201,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-4200","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-leaflet-js","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/4200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=4200"}],"version-history":[{"count":0,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/4200\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/4201"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=4200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=4200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=4200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}