{"id":272,"date":"2018-12-13T23:20:46","date_gmt":"2018-12-13T14:20:46","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=272"},"modified":"2018-12-13T23:20:46","modified_gmt":"2018-12-13T14:20:46","slug":"mapbox%e3%81%a7%e9%80%86%e3%82%b8%e3%82%aa%e3%82%b3%e3%83%bc%e3%83%87%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%97%e3%81%9f%e3%81%84","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2018\/12\/13\/272\/","title":{"rendered":"Mapbox\u3067\u9006\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u305f\u3044"},"content":{"rendered":"<p><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=net.dalomo.santaradar\">https:\/\/play.google.com\/store\/apps\/details?id=net.dalomo.santaradar<\/a><\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/revgeo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-273\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/revgeo-300x42.png\" alt=\"\" width=\"300\" height=\"42\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/revgeo-300x42.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/revgeo.png 715w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>\u9006\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0<\/h2>\n<p>\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3063\u3066\u3044\u3046\u306e\u304c\u3001\u4f4f\u6240\u304b\u3089\u7def\u5ea6\u7d4c\u5ea6\u3092\u6c42\u3081\u308b\u3084\u3064\u3067\u3001\u305d\u306e\u9006\u3060\u304b\u3089\u3001\u7def\u5ea6\u7d4c\u5ea6\u304b\u3089\u4f4f\u6240\u3092\u6c42\u3081\u308b\u3002\u306a\u308b\u307b\u3002\u30b5\u30f3\u30d7\u30eb\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u30b3\u30d4\u30da\u3057\u305f\u308d\u3068\u601d\u3063\u305f\u306e\u3060\u3051\u308c\u3069\u3001\u30b3\u30d4\u30da\u3082\u4e00\u7b4b\u7e04\u3067\u306f\u3044\u304b\u306a\u304b\u3063\u305f\u3002<\/p>\n<pre>Point searchLocationPoint = Point.fromLngLat(mll.getLongitude(), mll.getLatitude());<\/pre>\n<pre>if (!(searchLocationPoint == null)) {\r\n    try {\r\n        MapboxGeocoding reverseGeocode = MapboxGeocoding.builder()\r\n                .accessToken(\"token\")\r\n                .query(searchLocationPoint)\r\n                .country(\"JP\")\r\n                .geocodingTypes(GeocodingCriteria.TYPE_PLACE)\r\n                .build();\r\n\r\n        reverseGeocode.enqueueCall(new Callback&lt;GeocodingResponse&gt;() {\r\n            @Override\r\n            public void onResponse(Call&lt;GeocodingResponse&gt; call,\r\n                                   Response&lt;GeocodingResponse&gt; response) {\r\n                List&lt;CarmenFeature&gt; results = response.body().features();\r\n                if (results.size() &gt; 0) {\r\n\r\n                    CarmenFeature feature = results.get(0);\r\n                    Log.d(\"debug\", feature.placeName());\r\n                } else {\r\n\r\n                }\r\n            }\r\n\r\n            @Override\r\n            public void onFailure(Call&lt;GeocodingResponse&gt; call, Throwable throwable) {\r\n                throwable.printStackTrace();\r\n            }\r\n        });\r\n\r\n    } catch (ServicesException servicesException) {\r\n        \r\n    }\r\n}<\/pre>\n<p>\u307b\u307c\u30b3\u30d4\u30da\u3060\u30fc\u3002\u3051\u3069\u3053\u308c\u304c\u52d5\u304f\u307e\u3067\u7d50\u69cb\u96e3\u5100\u3057\u305f\u3002<\/p>\n<h3>\u52d8\u9055\u3044\u305d\u306e\u2460-GeocodingAPI\u5165\u308c\u3066\u306a\u3044<\/h3>\n<p>Mapbox\u306eSDK\u304c\u5165\u3063\u3066\u308a\u3083\u4f7f\u3048\u308b\u3082\u3093\u3060\u3068\u601d\u3063\u3066\u305f\u3002Mapboxgeocoding\u304c\u8d64\u5b57\u306b\u306a\u3063\u3066\u306a\u3093\u3067\u3060\u30fc\u306a\u3093\u3067\u3060\u30fc\u3063\u3068\u3084\u3063\u3066\u3044\u305f\u306e\u3060\u3051\u308c\u3069\u3001\u305d\u308c\u7528\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u8ffd\u52a0\u3059\u308b\u305f\u3081\u306b\u3001gradle\u306b\u8ffd\u8a18\u3057\u306a\u304d\u3083\u3044\u3051\u306a\u304b\u3063\u305f\u3002<\/p>\n<pre>implementation 'com.mapbox.mapboxsdk:mapbox-sdk-core:4.1.1'\r\nimplementation 'com.mapbox.mapboxsdk:mapbox-sdk-geojson:4.1.1'\r\nimplementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:4.1.1'<\/pre>\n<p>\u3092app\u30ec\u30d9\u30eb\u306edependencies {}\u306b\u8ffd\u8a18\u3057\u305f\u3089\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n<h3>\u52d8\u9055\u3044\u305d\u306e\u2461-Retrofit2\u304c\u5fc5\u8981\u3060\u3063\u305f\u3001\u591a\u5206<\/h3>\n<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u30b3\u30d4\u30da\u3057\u3066Alt+Enter\u3068\u304b\u3084\u3063\u3066\u308b\u3068\u3001\u3044\u3064\u306e\u9593\u306b\u304b<\/p>\n<pre>import retrofit2.Call;\r\nimport retrofit2.Callback;\r\nimport retrofit2.Response;<\/pre>\n<p>\u3068\u3044\u3046\u306e\u304cimport\u3055\u308c\u308b\u3002\u52dd\u624b\u306b\u3055\u308c\u305f\u306e\u3067\u3001\u3082\u3046\u4f7f\u3048\u308b\u3082\u3093\u3060\u3068\u601d\u3063\u3066\u3044\u305f\u3089\u305d\u3046\u3058\u3083\u306a\u3044\u307f\u305f\u3044\u3002\u3053\u308c\u3082\u3084\u3063\u3071\u308agradle\u306b\u8ffd\u8a18\u3057\u306a\u304d\u3083\u30c0\u30e1\u3060\u3063\u305f\u3002<\/p>\n<pre>implementation 'com.squareup.retrofit2:retrofit:2.4.0'\r\nimplementation 'com.squareup.retrofit2:converter-gson:2.4.0'<\/pre>\n<p>\u3053\u308c\u306b\u6c17\u3065\u304f\u307e\u3067\u3001\u30b5\u30f3\u30d7\u30eb\u901a\u308a\u306b\u66f8\u3044\u3066\u3093\u306e\u306b\u306a\u3093\u3067\u53d6\u5f97\u3067\u304d\u3093\u306e\u3058\u3083\u3068\u601d\u3044\u60a9\u3093\u3067\u3044\u305f\u3002\u521d\u5fc3\u8005\u306b\u306f\u53b3\u3057\u3044\u3088\u3046\u3002\u3067\u3001\u3053\u308c\u306f\u4f55\u306a\u306e\u3001\u3068\u601d\u3044\u8abf\u3079\u3066\u307f\u305f\u3051\u3069API\u3092\u4f7f\u3046\u306e\u3092\u4fbf\u5229\u306b\u3057\u3066\u304f\u308c\u308b\u3001\u975e\u540c\u671f\u51e6\u7406\u3082\u3057\u3066\u304f\u308c\u308b\u3002\u3050\u3089\u3044\u3057\u304b\u5206\u304b\u3089\u3093\u3002\u982d\u3082\u8ffd\u3044\u3064\u304b\u305a\u3001\u3044\u3064\u304b\u5206\u304b\u308b\u65e5\u304c\u6765\u308b\u3068\u3044\u3044\u306a\u2026\u3002<\/p>\n<h4>\u53c2\u8003<\/h4>\n<p><a href=\"https:\/\/www.tsurutan.com\/entry\/2016\/10\/04\/003929\">https:\/\/www.tsurutan.com\/entry\/2016\/10\/04\/003929<\/a><\/p>\n<p><a href=\"https:\/\/qiita.com\/hymmr\/items\/cbb1013617cd43b8c7c4\">https:\/\/qiita.com\/hymmr\/items\/cbb1013617cd43b8c7c4<\/a><\/p>\n<p><a href=\"https:\/\/qiita.com\/thdroid\/items\/f648895b805539a9d620\">https:\/\/qiita.com\/thdroid\/items\/f648895b805539a9d620<\/a><\/p>\n<h3>\u7406\u89e3\u3067\u304d\u305f\u3068\u601d\u308f\u308c\u308b\u3053\u3068<\/h3>\n<p>\u4e0a\u304b\u3089\u3002<\/p>\n<ol>\n<li>Point.fromLngLat\u3067\u4f4f\u6240\u3092\u53d6\u5f97\u3057\u305f\u3044\u5730\u70b9\u306e\u5ea7\u6a19\u304b\u3089Point\u3092\u4f5c\u308b\u3002<\/li>\n<li>MapboxGeocoding.builder()\u3067\u8a2d\u5b9a\u3059\u308b\u3002\n<ul>\n<li>accessToken &#8211; \u81ea\u5206\u306e\u30c8\u30fc\u30af\u30f3\u3092\u66f8\u304f\u3002<\/li>\n<li>query &#8211; \u5ea7\u6a19\u3092Point\u578b\u3067\u66f8\u304f\u3002<\/li>\n<li>country &#8211; \u56fd\u3092\u9650\u5b9a\u3059\u308b\u3002\u81ea\u5206\u306e\u5834\u5408\u3044\u3089\u3093\u304b\u3082\u3002<\/li>\n<li>geocodingTypes &#8211; \u4f4f\u6240\u306e\u5f62\u5f0f\u3002TYPE_PLACE\u3067\u5e02\u753a\u6751\u540d\u307e\u3067\u3002<a href=\"https:\/\/www.mapbox.com\/api-documentation\/?language=Java#data-types\">\u3053\u3053<\/a>\u53c2\u7167\u3002<\/li>\n<li>builder &#8211; \u5b9f\u884c\u307f\u305f\u3044\u306a\u3084\u3064\u3001\u591a\u5206\u3002<\/li>\n<li>\u4ed6\u306b\u3082\u3042\u308b\u3051\u3069\u4ffa\u306f\u3044\u3093\u306a\u304b\u3063\u305f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>encueCall\u3067\u30c7\u30fc\u30bf\u53d6\u308a\u306b\u884c\u304f\u3002<\/li>\n<li>onResponce\u304c\u6210\u529f\u3057\u305f\u5834\u5408\u306e\u51e6\u7406\u2026\u306a\u306e\u304b\u306a\u3002API\u7528\u306eGeoJSON\u578b\u307f\u305f\u3044\u306a\u306e\u3067\u8fd4\u3063\u3066\u304f\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u53d7\u3051\u3066\u3042\u3052\u3066\u3001\u81ea\u5206\u306e\u3057\u305f\u3044\u51e6\u7406\u3092\u66f8\u304f\u3002Feature\u306egetplaceName\u3067\u4f4f\u6240\u304c\u53d6\u5f97\u3067\u304d\u308b\u3002<\/li>\n<li>onFailure\u304c\u5931\u6557\u3057\u305f\u6642\u306e\u51e6\u7406\u304b\u306a\u3002\u3053\u3053\u3067\u4f55\u3059\u308c\u3070\u3044\u3044\u306e\u304b\u5206\u304b\u3089\u3093\u306e\u3067\u30b5\u30f3\u30d7\u30eb\u306e\u307e\u307e\u3002<\/li>\n<\/ol>\n<p>Log.d\u3067\u898b\u3066\u307f\u305f\u3089\u3001\u3061\u3083\u3093\u3068\u53d6\u5f97\u3067\u304d\u3066\u305f\u3002\u4e0a\u306e\u753b\u50cf\u306d\u3002<\/p>\n<p>\u3069\u3063\u304b\u306bLog\u306e\u4ee3\u308f\u308a\u306bTimber\u3063\u3066\u3044\u3046\u306e\u3092\u4f7f\u3063\u3066\u308b\u30b3\u30fc\u30c9\u3092\u898b\u304b\u3051\u305f\u3051\u3069\u3001\u305d\u308c\u4f7f\u3063\u305f\u3089<\/p>\n<blockquote><p>Since Timber is included in the project, it is likely that calls to Log should instead be going to Timber.<\/p><\/blockquote>\n<p>\u3063\u3066\u5acc\u5473\u8a00\u308f\u308c\u308b\u3093\u3060\u3051\u3069\u3002import\u6d88\u3057\u3066\u3082\u305a\u3063\u3068\u51fa\u308b\u3093\u3067\u3059\u3051\u3069\u3002\u306a\u3093\u306a\u306e\u3002<\/p>\n<h3>\u305d\u308c\u304b\u3089<\/h3>\n<p>\u53d6\u5f97\u3067\u304d\u305f\u4f4f\u6240\u3092\u30de\u30fc\u30ab\u30fc\u306b\u8a2d\u5b9a\u3057\u3088\u3046\u3068\u3057\u3066\u3082\u3067\u304d\u306a\u3044\u3002\u3053\u3053\u306f\u3082\u3046\u5168\u7136\u5206\u304b\u3089\u3093\u306a\u3002\u3069\u3046\u3084\u3063\u3066\u8868\u73fe\u3057\u3088\u3063\u304b\u306a\u30fc\u3002<\/p>\n<h3>\u53c2\u8003<\/h3>\n<p><a href=\"https:\/\/www.mapbox.com\/android-docs\/java\/overview\/geocoder\/\">https:\/\/www.mapbox.com\/android-docs\/java\/overview\/geocoder\/<\/a><\/p>\n<p><a href=\"https:\/\/www.mapbox.com\/api-documentation\/?language=Java#retrieve-places-near-a-location\">https:\/\/www.mapbox.com\/api-documentation\/?language=Java#retrieve-places-near-a-location<\/a><\/p>\n<p><a href=\"https:\/\/www.mapbox.com\/android-docs\/java\/examples\/geocoding-java-service\/\">https:\/\/www.mapbox.com\/android-docs\/java\/examples\/geocoding-java-service\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/play.google.com\/store\/apps\/details?id=net.dalomo.santaradar \u9006\u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0 \u30b8\u30aa\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3063\u3066\u3044\u3046\u306e\u304c\u3001\u4f4f\u6240\u304b\u3089\u7def\u5ea6\u7d4c\u5ea6\u3092\u6c42\u3081\u308b\u3084\u3064\u3067\u3001\u305d &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2018\/12\/13\/272\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":273,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[9],"tags":[3,6,22,4,24],"class_list":["post-272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-9","tag-android","tag-androidstudio","tag-mapbox","tag-4","tag-24"],"_links":{"self":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/comments?post=272"}],"version-history":[{"count":1,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/272\/revisions"}],"predecessor-version":[{"id":274,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/272\/revisions\/274"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media\/273"}],"wp:attachment":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media?parent=272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}