{"id":3186,"date":"2020-06-23T19:24:28","date_gmt":"2020-06-23T10:24:28","guid":{"rendered":"https:\/\/taitan916.info\/blog\/?p=3186"},"modified":"2024-01-16T18:29:17","modified_gmt":"2024-01-16T09:29:17","slug":"post-3186","status":"publish","type":"post","link":"https:\/\/taitan916.info\/blog\/archives\/3186","title":{"rendered":"\u56fd\u571f\u5730\u7406\u9662\u306eAPI\u3092\u4f7f\u7528\u3057\u3066\u7121\u6599\u3067\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0(\u4f4f\u6240\u2192\u7d4c\u5ea6\u7def\u5ea6)\u3092\u884c\u3046\u65b9\u6cd5"},"content":{"rendered":"<p>GoogleMapAPI\u3067\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u3059\u308b\u306b\u306f\u3001\u652f\u6255\u3044\u60c5\u5831\u3092\u767b\u9332\u3057\u305f\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u3066API\u30ad\u30fc\u3092\u767a\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u975e\u5e38\u306b\u9762\u5012\u304f\u3055\u3044\u3002\u3068\u306f\u3044\u3048OSM+leaflet.js\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u3082\u6709\u7528\u306a\u60c5\u5831\u304c\u898b\u3064\u304b\u3089\u305a\u7d50\u5c40\u306e\u3068\u3053\u308d\u5730\u7406\u9662\u5730\u56f3\u306e\u30b8\u30aa\u30b3\u30fc\u30c0\u30fc\u3092\u4f7f\u3046\u65b9\u6cd5\u306b\u843d\u3061\u7740\u3044\u305f\u3002\u4ee5\u4e0b\u306b\u65b9\u6cd5\u3092\u30e1\u30e2\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p><a href=\"https:\/\/taitan916.info\/sample\/osm\/geocoder.php\" target=\"_blank\" rel=\"noopener\">https:\/\/taitan916.info\/sample\/osm\/geocoder.php<\/a><\/p>\n<p>\u4f4f\u6240\u3092\u5165\u529b\u3057\u300c\u7d4c\u5ea6\u7def\u5ea6\u53d6\u5f97\u300d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u7d4c\u5ea6\u30fb\u7def\u5ea6\u304c\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u5165\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30bd\u30fc\u30b9<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;html lang=\"ja\"&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\"&gt;\r\n&lt;title&gt;\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n\u4f4f\u6240&lt;input type=\"text\" name=\"address\" id=\"address\"&gt;&lt;br&gt;\r\n\u7d4c\u5ea6&lt;input type=\"text\" name=\"lat\" id=\"lat\"&gt;&lt;br&gt;\r\n\u7d4c\u5ea6&lt;input type=\"text\" name=\"lng\" id=\"lng\"&gt;&lt;br&gt;\r\n&lt;a href=\"javascript:void(0);\" onclick=\"return getLatLng();\"&gt;\u7d4c\u5ea6\u7def\u5ea6\u53d6\u5f97&lt;\/a&gt;\r\n\r\n&lt;div id=\"map\"&gt;&lt;\/div&gt;\r\n\r\n&lt;link rel=\"stylesheet\" href=\"http:\/\/cdn.leafletjs.com\/leaflet-0.7.3\/leaflet.css\" \/&gt;\r\n&lt;script src=\"http:\/\/cdn.leafletjs.com\/leaflet-0.7.3\/leaflet.js\"&gt;&lt;\/script&gt; \r\n&lt;script src=\"http:\/\/code.jquery.com\/jquery-latest.js\"&gt;&lt;\/script&gt;\r\n&lt;script&gt;\r\nfunction getLatLng(){\r\n    var address = $('#address').val();\r\n    $.ajax({\r\n        url:'https:\/\/msearch.gsi.go.jp\/address-search\/AddressSearch?q=' + address, \r\n        }).done(function(res, textStatus, jqXHR) {\r\n\r\n        if( res.length ){\r\n            var latlng = res[0].geometry.coordinates;\r\n            $('#lat').val(latlng[0]);\r\n            $('#lng').val(latlng[1]);\r\n        }\r\n    });\r\n}\r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>ajax\u901a\u4fe1\u3067\u30b8\u30aa\u30b3\u30fc\u30c0\u30fc\u306b\u63a5\u7d9a\u3057\u3066\u3044\u308b\u3002length\u304c0\u306e(\u7d50\u679c\u304c\u7121\u3044)\u5834\u5408\u306f\u4f55\u3082\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u304c\u3001\u3082\u3046\u3061\u3087\u3063\u3068\u30a8\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u306f\u5165\u308c\u305f\u307b\u3046\u304c\u826f\u3055\u305d\u3046\u3002<\/p>\n<p>\u5c1a\u3001\u4ee5\u4e0b\u304c\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306b\u306a\u308b\u3002<\/p>\n<p><a href=\"https:\/\/ucopendb.gsi.go.jp\/ucode\/help_with_API.html\">https:\/\/ucopendb.gsi.go.jp\/ucode\/help_with_API.html<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>OpenStreetMap\u306eAPI<\/h2>\n<p>OSM\u3067\u3082API\u304c\u3042\u308a\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5f62\u3067\u63a5\u7d9a\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">http:\/\/nominatim.openstreetmap.org\/search?format=json&amp;q=\u4f4f\u6240<\/pre>\n<p>\u3057\u304b\u3057\u306a\u304c\u3089\u5730\u7406\u9662\u3088\u308a\u3082\u5927\u5e45\u306b\u52a3\u308a\u3001\u4f8b\u3048\u3070\u300c\u6771\u4eac\u30bf\u30ef\u30fc\u300d\u3068\u5165\u529b\u3059\u308b\u3068\u6b63\u5e38\u306b\u7d4c\u5ea6\u7def\u5ea6\u3092\u53d6\u5f97\u3067\u304d\u308b\u304c\u3001\u300c\u6771\u4eac\u90fd\u6e2f\u533a\u829d\u516c\u5712\uff14\u4e01\u76ee\uff12\u2212\uff18\u300d\u3068\u304b\u3060\u3068\u53d6\u5f97\u3067\u304d\u305a\u5b9f\u969b\u306b\u4f7f\u7528\u3059\u308b\u306b\u306f\u307e\u3060\u307e\u3060\u53b3\u3057\u305d\u3046\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>leaflet.js\u306e\u30d7\u30e9\u30b0\u30a4\u30f3<\/h2>\n<p>Leaflet Control OSM Geocoder\u3068\u3044\u3046\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u7528\u3059\u308b\u3068\u5730\u56f3\u304b\u3089\u5834\u6240\u3092\u691c\u7d22\u3059\u308b\u3068\u3044\u3046\u6a5f\u80fd\u3092\u8ffd\u52a0\u3067\u304d\u308b\u3002\u3057\u304b\u3057\u3053\u3061\u3089\u3067\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u3092\u7528\u610f\u3057\u3001\u4f55\u3089\u304b\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8d77\u3053\u3057\u305f\u969b\u306b\u7d4c\u5ea6\u7def\u5ea6\u3092\u53d6\u5f97\u3059\u308b\u3068\u8a00\u3046\u65b9\u6cd5\u304c\u5206\u304b\u3089\u306a\u304b\u3063\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001\u3069\u306e\u9053OSM\u306e\u30b8\u30aa\u30b3\u30fc\u30c0\u30fc\u3092\u4f7f\u3046\u306e\u3067\u3042\u308c\u3070\u5730\u7406\u9662\u3084GoogleMapAPI\u30af\u30e9\u30b9\u306e\u7cbe\u5ea6\u306f\u51fa\u306a\u3044\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u6240\u611f<\/h2>\n<p>leaflet.js\u3068OSM\u3067\u4f55\u3068\u304b\u3057\u305f\u304b\u3063\u305f\u306e\u3067\u7d50\u8ad6\u304c\u51fa\u308b\u307e\u3067\u306b\u3060\u3044\u3076\u6642\u9593\u3092\u304b\u3051\u3066\u3057\u307e\u3063\u305f\u3002\u3057\u304b\u3057\u306a\u304c\u3089\u7121\u6599\u3067\u9762\u5012\u304f\u3055\u3044\u624b\u7d9a\u304d\u7121\u304f\u3001\u3042\u308b\u7a0b\u5ea6\u7cbe\u5ea6\u306e\u9ad8\u3044\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u304c\u3067\u304d\u308c\u3070\u3069\u306e\u30b5\u30fc\u30d3\u30b9\u3067\u3082\u826f\u3044\u3002\u4eca\u5f8c\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u969b\u306f\u5730\u7406\u9662API\u3092\u9078\u629e\u80a2\u306e\u4e00\u3064\u3068\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GoogleMapAPI\u3067\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u3059\u308b\u306b\u306f\u3001\u652f\u6255\u3044\u60c5\u5831\u3092\u767b\u9332\u3057\u305f\u30a2\u30ab\u30a6 ... <\/p>\n","protected":false},"author":1,"featured_media":1067,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-3186","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","category-javascript"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/3186","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=3186"}],"version-history":[{"count":0,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/3186\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media\/1067"}],"wp:attachment":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media?parent=3186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/categories?post=3186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/tags?post=3186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}