{"id":5698,"date":"2024-06-07T00:01:22","date_gmt":"2024-06-06T15:01:22","guid":{"rendered":"https:\/\/taitan916.info\/blog\/?p=5698"},"modified":"2024-06-06T23:33:54","modified_gmt":"2024-06-06T14:33:54","slug":"post-5698","status":"publish","type":"post","link":"https:\/\/taitan916.info\/blog\/archives\/5698","title":{"rendered":"Leaflet\u3067\u300cleaflet-control-geocoder\u300d\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u5c0e\u5165\u3057\u3066\u4f4f\u6240\u691c\u7d22\u6a5f\u80fd\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>Leaflet\u3068OpenStreetMap\u3067\u30de\u30c3\u30d7\u3092\u8868\u793a\u3055\u305b\u3001\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u4f4f\u6240\u3084\u5efa\u7269\u540d(\u6771\u4eac\u30bf\u30ef\u30fc)\u7b49\u3092\u5165\u529b\u3059\u308b\u3068\u691c\u7d22\u3067\u304d\u308b\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u305f\u3044\u3002\u300cleaflet-control-geocoder\u300d\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u5c0e\u5165\u3059\u308b\u3053\u3068\u3067\u5b9f\u88c5\u3067\u304d\u308b\u6a21\u69d8\u3002\u4ee5\u4e0b\u306b\u30b5\u30f3\u30d7\u30eb\u53ca\u3073\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u30e1\u30e2\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>leaflet-control-geocoder<\/h2>\n<h3>GitHub<\/h3>\n<p><a href=\"https:\/\/github.com\/perliedman\/leaflet-control-geocoder\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/perliedman\/leaflet-control-geocoder<\/a><\/p>\n<h3>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/h3>\n<p><a href=\"https:\/\/www.liedman.net\/leaflet-control-geocoder\/docs\/index.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.liedman.net\/leaflet-control-geocoder\/docs\/index.html<\/a><\/p>\n<h3>CDN<\/h3>\n<p>CDN\u3067\u4f7f\u3046\u5834\u5408\u306f\u4ee5\u4e0b\u3092\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/perliedman-leaflet-control-geocoder\/2.4.0\/Control.Geocoder.min.js\"&gt;&lt;\/script&gt;\r\n&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/perliedman-leaflet-control-geocoder\/2.4.0\/Control.Geocoder.min.css\"&gt;<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p><a href=\"https:\/\/taitan916.info\/sample\/leaflet.js\/plugin\/leaflet-control-geocoder\/\" target=\"_blank\" rel=\"noopener\">https:\/\/taitan916.info\/sample\/leaflet.js\/plugin\/leaflet-control-geocoder\/<\/a><\/p>\n<p>\u30de\u30c3\u30d7\u53f3\u4e0a\u306b\u691c\u7d22\u7528\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u304c\u8868\u793a\u3055\u308c\u3001\u4f4f\u6240\u3084\u5efa\u7269\u540d(\u6771\u4eac\u30bf\u30ef\u30fc)\u7b49\u3092\u5165\u529b\u3059\u308b\u3068\u691c\u7d22\u3067\u304d\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u5b9f\u88c5\u65b9\u6cd5<\/h2>\n<h3>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;div id=\"map\"&gt;&lt;\/div&gt;\r\n\r\n&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/leaflet\/1.9.4\/leaflet.css\"\/&gt;\r\n&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/leaflet\/1.9.4\/leaflet.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/perliedman-leaflet-control-geocoder\/2.4.0\/Control.Geocoder.min.js\"&gt;&lt;\/script&gt;\r\n&lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/perliedman-leaflet-control-geocoder\/2.4.0\/Control.Geocoder.min.css\"&gt;\r\n\r\n&lt;script&gt;\r\nlet map;\r\nmap = L.map('map');\r\n\r\n\/\/\u4e2d\u5fc3\u306e\u7d4c\u5ea6\u7def\u5ea6\r\nconst center = ['35.681236', '139.767125'];\r\n\r\n\/\/\u30ba\u30fc\u30e0\u30ec\u30d9\u30eb\r\nconst zoom = 12;\r\n\r\n\/\/\u30de\u30c3\u30d7\u306e\u4e2d\u5fc3\u5730\u3068\u30ba\u30fc\u30e0\u30ec\u30d9\u30eb\u3092\u6307\u5b9a\r\nmap.setView(center, zoom);\r\n\r\nconst tileLayer = L.tileLayer('https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png',{\r\n    attribution: '\u00a9 &lt;a href=\"http:\/\/osm.org\/copyright\"&gt;OpenStreetMap&lt;\/a&gt;',\r\n    maxZoom: 19\r\n});\r\ntileLayer.addTo(map);\r\n\r\n\/\/\u4f4f\u6240\u691c\u7d22\u6a5f\u80fd\r\nconst option = {\r\n    collapsed: false, \/\/\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u6298\u308a\u7573\u307f\r\n    placeholder: '\u4f4f\u6240\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002', \/\/\u30d7\u30ec\u30fc\u30b9\u30db\u30eb\u30c0\u30fc\u30c6\u30ad\u30b9\u30c8\r\n    errorMessage: '\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f', \r\n    showUniqueResult: false,\r\n}\r\nL.Control.geocoder(option).addTo(map);\r\n\r\n&lt;\/script&gt;<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u6240\u611f<\/h2>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u307e\u307e\u3060\u3068\u691c\u7d22\u306e\u7cbe\u5ea6\u304c\u4f4e\u3081\u306b\u611f\u3058\u305f\u3002<a href=\"https:\/\/github.com\/perliedman\/leaflet-control-geocoder\/tree\/1.13.0?tab=readme-ov-file#leaflet-control-geocoder--\" target=\"_blank\" rel=\"noopener\">\u30b8\u30aa\u30b3\u30fc\u30c0\u30fc\u3092\u5909\u66f4<\/a>\u3059\u308b\u3053\u3068\u3067\u6539\u5584\u3059\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001API\u30ad\u30fc\u306e\u7528\u610f\u304c\u5fc5\u8981\u3060\u3063\u305f\u308a\u3067\u3061\u3087\u3063\u3068\u9762\u5012\u306a\u3068\u3053\u308d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Leaflet\u3068OpenStreetMap\u3067\u30de\u30c3\u30d7\u3092\u8868\u793a\u3055\u305b\u3001\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b ... <\/p>\n","protected":false},"author":1,"featured_media":5571,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4],"tags":[101],"class_list":["post-5698","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-leaflet"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/5698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/comments?post=5698"}],"version-history":[{"count":3,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/5698\/revisions"}],"predecessor-version":[{"id":5701,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/5698\/revisions\/5701"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media\/5571"}],"wp:attachment":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media?parent=5698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/categories?post=5698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/tags?post=5698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}