{"id":7541,"date":"2021-12-06T09:02:33","date_gmt":"2021-12-06T00:02:33","guid":{"rendered":"https:\/\/gunmagisgeek.com\/blog\/?p=7541"},"modified":"2021-12-06T09:02:34","modified_gmt":"2021-12-06T00:02:34","slug":"deck-gl%e3%81%a7%e3%83%84%e3%83%bc%e3%83%ab%e3%83%81%e3%83%83%e3%83%97%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/7541","title":{"rendered":"deck.gl\u3067\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u8868\u793a\u3059\u308b"},"content":{"rendered":"\n<p>  \u3053\u306e\u8a18\u4e8b\u306f<a href=\"https:\/\/qiita.com\/advent-calendar\/2021\/deckgl\">deck.gl Advent Calendar 2021 <\/a>\u53c2\u52a0\u8a18\u4e8b\u3067\u3059\u3002  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6982\u8981<\/h2>\n\n\n\n<p>deck.gl\u3067\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u3053\u3067\u306fdeck.gl\u306b\u6a19\u6e96\u3067\u5099\u308f\u3063\u3066\u3044\u308b\u30d3\u30eb\u30c8\u30a4\u30f3\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<iframe src=\"https:\/\/codesandbox.io\/embed\/turutitupuwobiao-shi-suru-6pps9?fontsize=14&amp;hidenavigation=1&amp;theme=dark&amp;view=split\" style=\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\" title=\"\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u8868\u793a\u3059\u308b\" allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\" sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"><\/iframe>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u8aac<\/h2>\n\n\n\n<p>deck.gl\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u306f\u3001getTooltip\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u901a\u3057\u3066\u30d3\u30eb\u30c8\u30a4\u30f3\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p> getTooltip\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u306f\u3001\u5f15\u6570\u304b\u3089\u30de\u30a6\u30b9\u30db\u30d0\u30fc\u4e0b\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u623b\u308a\u5024\u306b\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u5185\u306b\u51fa\u529b\u3059\u308bhtml\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>GeoJSON\u30ec\u30a4\u30e4\u30fc\u306b\u8a2d\u5b9a\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3001\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u5185\u306b\u30c6\u30fc\u30d6\u30eb\u3068\u3057\u3066\u51fa\u529b\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u306f\u4ee5\u4e0b\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js decode:true \" title=\"App.js\">\/\/\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u751f\u6210\u3059\u308b\nconst tooltipHandler = (d) =&gt; {\n    \/\/\u30de\u30a6\u30b9\u30db\u30d0\u30fc\u4f4d\u7f6e\u306b\u5730\u7269\u304c\u5b58\u5728\u3059\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b\n    if (!d || !d.object) return null;\n    let obj = d.object;\n\n    \/\/geojson\u30ec\u30a4\u30e4\u30fc\u306e\u5834\u5408\u306fproperties\u306e\u5024\u3092obj\u306b\u5165\u308c\u308b\n    if (d.object.properties) obj = d.object.properties;\n\n    \/\/\u30c7\u30fc\u30bf\u304b\u3089tr\u8981\u7d20\u3092\u751f\u6210\u3059\u308b\n    const trs = Object.keys(obj)\n        .filter(key =&gt; obj[key]) \/\/\u5024\u304cnull\u3084\"\"\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u7701\u304f\n        .map(key =&gt; `&lt;tr&gt;&lt;th style=\"text-align:right\"&gt;${key}&lt;\/th&gt;&lt;td&gt;${obj[key]}&lt;\/td&gt;&lt;\/tr&gt;`)\n        .join(\"\\n\");\n\n    \/\/tooltip\u5185\u306b\u51fa\u529b\u3059\u308bhtml\u8981\u7d20\u3092\u751f\u6210\u3059\u308b\n    const html = [\"&lt;table&gt;\", trs, \"&lt;\/table&gt;\"].join(\"\\n\");\n\n    return {\n        \/\/ tooltip\u5185\u306b\u51fa\u529b\u3059\u308bhtml\u8981\u7d20\u3092\u6e21\u3059\n        html: html,\n        \/\/ tooltip\u5185\u306ehtml\u306b\u9069\u7528\u3059\u308bstyle\u3092\u8a2d\u5b9a\u3059\u308b\n        style: {\n            fontSize: \"0.5em\"\n        }\n    };\n};\n\n\nreturn (\n    &lt;DeckGL\n        getTooltip={tooltipHandler}\n    \/&gt;\n)<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u304a\u307e\u3051<\/h2>\n\n\n\n<p>\u3064\u3044\u3067\u306b\u30af\u30ea\u30c3\u30af\u6642\u306b\u30ab\u30b9\u30bf\u30e0\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u8868\u793a\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u3082\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u306e\u3067\u8208\u5473\u3042\u308b\u65b9\u306f\u30ea\u30f3\u30af\u5148\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"942\" height=\"802\" src=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2021\/11\/click-tooltip.jpg\" alt=\"\" class=\"wp-image-7608\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2021\/11\/click-tooltip.jpg 942w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2021\/11\/click-tooltip-176x150.jpg 176w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2021\/11\/click-tooltip-768x654.jpg 768w\" sizes=\"auto, (max-width: 942px) 100vw, 942px\" \/><figcaption><a href=\"https:\/\/codesandbox.io\/s\/deck-kuritukushi-nikasutamuturutitupuwobiao-shi-suru-x2gj3\" data-type=\"URL\" data-id=\"https:\/\/codesandbox.io\/s\/deck-kuritukushi-nikasutamuturutitupuwobiao-shi-suru-x2gj3\"><a href=\"https:\/\/codesandbox.io\/s\/deck-gl-kuritukushi-nikasutamuturutitupuwobiao-shi-suru-x2gj3\">deck.gl &#8211; \u30af\u30ea\u30c3\u30af\u6642\u306b\u30ab\u30b9\u30bf\u30e0\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u8868\u793a\u3059\u308b &#8211; CodeSandbox<\/a><\/a><\/figcaption><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u306fdeck.gl Advent Calen&hellip;<\/p>\n","protected":false},"author":1,"featured_media":7569,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-7541","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-deck-gl","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7541","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=7541"}],"version-history":[{"count":10,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7541\/revisions"}],"predecessor-version":[{"id":7765,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7541\/revisions\/7765"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/7569"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=7541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=7541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=7541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}