{"id":7575,"date":"2021-12-08T08:17:46","date_gmt":"2021-12-07T23:17:46","guid":{"rendered":"https:\/\/gunmagisgeek.com\/blog\/?p=7575"},"modified":"2021-12-08T12:06:24","modified_gmt":"2021-12-08T03:06:24","slug":"deck-gl%e3%81%a7%e3%83%9e%e3%83%bc%e3%82%ab%e3%83%bc%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\/7575","title":{"rendered":"deck.gl\u3067\u30de\u30fc\u30ab\u30fc\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&nbsp;<\/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>\u5730\u56f3\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3057\u3066\u306f\u57fa\u672c\u7684\u306a\u6a5f\u80fd\u3067\u3042\u308b\u30de\u30fc\u30ab\u30fc\u8868\u793a\u3067\u3059\u304c\u3001deck.gl\u306b\u306f\u30de\u30fc\u30ab\u30fc\u3068\u3044\u3046\u7279\u5225\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u5b58\u5728\u3057\u306a\u3044\u306e\u3067\u3001<a href=\"https:\/\/deck.gl\/docs\/api-reference\/layers\/icon-layer\" data-type=\"URL\" data-id=\"https:\/\/deck.gl\/docs\/api-reference\/layers\/icon-layer\">iconLayer<\/a>\u3092\u4f7f\u7528\u3057\u3066\u30de\u30fc\u30ab\u30fc\u3092\u8868\u793a\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\/deck-gl-makawobiao-shi-suru-5o1mt?fontsize=14&amp;hidenavigation=1&amp;theme=dark&amp;view=split\" style=\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\" title=\"deck.gl - \u30de\u30fc\u30ab\u30fc\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>iconLayer\u306f\u30dd\u30a4\u30f3\u30c8\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3093\u3067\u30a2\u30a4\u30b3\u30f3\u3092\u8868\u793a\u3059\u308b\u30ec\u30a4\u30e4\u30fc\u3067\u3059\u304c\u3001\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u306e\u7e26\u5e45\u3084\u6a2a\u5e45\u3001\u8868\u793a\u4f4d\u7f6e\u3092\u6b63\u3057\u304f\u8abf\u6574\u3057\u306a\u3044\u3068\u4f4d\u7f6e\u304c\u305a\u308c\u3066\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u3092\u8a2d\u5b9a\u3059\u308bgetIcon\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u30a2\u30af\u30bb\u30b5\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u30c7\u30fc\u30bf\u306e\u5c5e\u6027\u5024\u3092\u5143\u306b\u51fa\u529b\u3059\u308b\u30a2\u30a4\u30b3\u30f3\u3092\u632f\u308a\u5206\u3051\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js decode:true \">const icon_option = {\n  marker: {\n    url: \".\/img\/marker.png\",\n    x: 0, \/\/\u753b\u50cf\u8aad\u307f\u8fbc\u307f\u306eX\u8ef8\u30aa\u30d5\u30bb\u30c3\u30c8\n    y: 0, \/\/\u753b\u50cf\u8aad\u307f\u8fbc\u307f\u306eY\u8ef8\u30aa\u30d5\u30bb\u30c3\u30c8\n    anchorY: 512, \/\/Y\u8ef8\u306e\u8868\u793a\u4f4d\u7f6e\uff08\u901a\u5e38\u753b\u50cf\u306e\u7e26\u5e45\u306b\u5408\u308f\u305b\u308b\uff09\n    width: 512, \/\/\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u306e\u6a2a\u5e45\n    height: 512, \/\/\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u306e\u7e26\u5e45\n    mask: true \/\/ture\u306b\u3059\u308b\u3068\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u306e\u8272\u306e\u4e0a\u5857\u308a\u306a\u3069\u304c\u53ef\u80fd\u306b\u306a\u308b\n  },\n  camera: {\n    url: \".\/img\/camera.png\",\n    x: 0, \/\/\u753b\u50cf\u8aad\u307f\u8fbc\u307f\u306eX\u8ef8\u30aa\u30d5\u30bb\u30c3\u30c8\n    y: 0, \/\/\u753b\u50cf\u8aad\u307f\u8fbc\u307f\u306eY\u8ef8\u30aa\u30d5\u30bb\u30c3\u30c8\n    anchorY: 512, \/\/Y\u8ef8\u306e\u8868\u793a\u4f4d\u7f6e\uff08\u901a\u5e38\u753b\u50cf\u306e\u7e26\u5e45\u306b\u5408\u308f\u305b\u308b\uff09\n    width: 512, \/\/\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u306e\u6a2a\u5e45\n    height: 512, \/\/\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u306e\u7e26\u5e45\n    mask: true \/\/ture\u306b\u3059\u308b\u3068\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u306e\u8272\u306e\u4e0a\u5857\u308a\u306a\u3069\u304c\u53ef\u80fd\u306b\u306a\u308b\n  }\n};\n\nexport function renderLayers(props) {\n  const { data } = props;\n\n  const iconLayer = new IconLayer({\n    id: \"icon-layer\",\n    data: data.features,\n    pickable: true,\n    getIcon: (d) =&gt; {\n      \/\/\u5c5e\u6027\u5024\u306etype\u3092\u307f\u3066\u30a2\u30a4\u30b3\u30f3\u3092\u51fa\u3057\u5206\u3051\u308b\n      return icon_option[d.properties.type];\n    },\n    sizeScale: 6, \/\/\u30a2\u30a4\u30b3\u30f3\u306e\u30b5\u30a4\u30ba\u306f\u3053\u3053\u3067\u8abf\u6574\u3059\u308b\n    getSize: 5, \/\/\u500b\u5225\u306b\u30b5\u30a4\u30ba\u3092\u5909\u5316\u3055\u305b\u305f\u3044\u5834\u5408\u306f\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u8a2d\u5b9a\u3059\u308b\n    getColor: [0, 120, 0, 255], \/\/\u30de\u30fc\u30ab\u30fc\u30ab\u30e9\u30fc\u3092\u4e0a\u5857\u308a\u3059\u308b(mask\u6709\u52b9\u6642\u306e\u307f)\n    getPosition: (d) =&gt; d.geometry.coordinates,\n    onClick: (d) =&gt; {\n      \/\/\u30de\u30fc\u30ab\u30fc\u30af\u30ea\u30c3\u30af\u6642\u306e\u51e6\u7406\n      console.log(d.object);\n    }\n  });\n\n  return [iconLayer];\n}<\/pre><\/div>\n\n\n\n<p>iconLayer\u306b\u3001<a href=\"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/7541\" data-type=\"URL\" data-id=\"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/7541\">\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u306e\u8868\u793a<\/a>\u3084<a href=\"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/7531\" data-type=\"URL\" data-id=\"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/7531\">\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u306e\u5909\u66f4<\/a>\u306a\u3069\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u4e00\u822c\u7684\u306a\u30de\u30fc\u30ab\u30fc\u306e\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u306fdeck.gl Advent Calen&hellip;<\/p>\n","protected":false},"author":1,"featured_media":7583,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-7575","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\/7575","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=7575"}],"version-history":[{"count":12,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7575\/revisions"}],"predecessor-version":[{"id":7783,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7575\/revisions\/7783"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/7583"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=7575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=7575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=7575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}