{"id":7660,"date":"2021-12-07T09:49:06","date_gmt":"2021-12-07T00:49:06","guid":{"rendered":"https:\/\/gunmagisgeek.com\/blog\/?p=7660"},"modified":"2021-12-07T09:49:07","modified_gmt":"2021-12-07T00:49:07","slug":"deck-gl%e3%81%a7%e6%97%a5%e6%9c%ac%e8%aa%9e%ef%bc%8f%e7%b5%b5%e6%96%87%e5%ad%97%e3%83%a9%e3%83%99%e3%83%ab%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\/7660","title":{"rendered":"deck.gl\u3067\u65e5\u672c\u8a9e\uff0f\u7d75\u6587\u5b57\u30e9\u30d9\u30eb\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\u306b\u306f\u5730\u56f3\u4e0a\u306b\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306eTextLayer\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u65e5\u672c\u8a9e\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093\u3002TextLayer\u3067\u65e5\u672c\u8a9e\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u8aac\u660e\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<p>\u30e9\u30d9\u30eb\u3092\u898b\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u30d9\u30fc\u30b9\u30de\u30c3\u30d7\u306e\u8868\u793a\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<iframe src=\"https:\/\/codesandbox.io\/embed\/deck-gl-ri-ben-yu-raberuwobiao-shi-suru-ci3c7?fontsize=14&amp;hidenavigation=1&amp;module=%2Fsrc%2FRenderLayers.js&amp;theme=dark&amp;view=split\" style=\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\" title=\"deck.gl -  \u65e5\u672c\u8a9e\u30e9\u30d9\u30eb\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>WebGL\u306b\u306f\u57fa\u672c\u30c6\u30ad\u30b9\u30c8\u3092\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3059\u308b\u6a5f\u80fd\u304c\u306a\u3044\u305f\u3081deck.gl\u306f\u30d5\u30a9\u30f3\u30c8\u30a2\u30c8\u30e9\u30b9\u3068\u3088\u3070\u308c\u308b\u30c6\u30af\u30b9\u30c1\u30e3\u3092\u52d5\u7684\u306b\u751f\u6210\u3057\u3001\u30c6\u30ad\u30b9\u30c8\u3092\u30c6\u30af\u30b9\u30c1\u30e3\u30fc\u753b\u50cf\u3068\u3057\u3066\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u306e\u307f\u304c\u30d5\u30a9\u30f3\u30c8\u30a2\u30c8\u30e9\u30b9\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u65e5\u672c\u8a9e\u306f\u8868\u793a\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u305d\u3053\u3067characterSet\u30d7\u30ed\u30d1\u30c6\u30a3\u306b \u30d5\u30a9\u30f3\u30c8\u30a2\u30c8\u30e9\u30b9\u3092\u751f\u6210\u3059\u308b\u6587\u5b57\u3092\u914d\u5217\u3068\u3057\u3066\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u306fpoint.geojson\u306elabel\u5c5e\u6027\u306b\u767b\u9332\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u3092\u5168\u3066\u53d6\u5f97\u3057\u3001\u4e00\u6587\u5b57\u3054\u3068\u306e\u914d\u5217\u3078\u3068\u5909\u63db\u3001\u91cd\u8907\u3092\u524a\u9664\u3057\u305f\u4e0a\u3067 characterSet\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u6e21\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js decode:true \">  \/\/\u5c5e\u6027\u5024\u306e\u30e9\u30d9\u30eb\u304b\u3089\u5fc5\u8981\u306a\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u30bb\u30c3\u30c8\u3092\u53d6\u5f97\u3059\u308b\n  const tmp = pointData.features\n    .map((d) =&gt; Array.from(d.properties.label)) \/\/\u30e9\u30d9\u30eb\u6587\u5b57\u5217\u3092\u53ce\u96c6\n    .flat();\n\n  \/\/\u91cd\u8907\u3092\u524a\u9664\n  const charaSet = Array.from(new Set(tmp)) \n\n  \/\/\u30c6\u30ad\u30b9\u30c8\u8868\u793a\u306b\u5fc5\u8981\u3068\u306a\u308b\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u30bb\u30c3\u30c8\n  console.log(charaSet);\n\n  \/\/\u30dd\u30a4\u30f3\u30c8\u30c7\u30fc\u30bf\u3092\u30c6\u30ad\u30b9\u30c8\u30e9\u30d9\u30eb\u3068\u3057\u3066\u51fa\u529b\n  const textLayer = new TextLayer({\n    id: \"text-layer\",\n    data: pointData.features,\n    stroked: true,\n    filled: true,\n    getPosition: (d) =&gt; {\n      return d.geometry.coordinates;\n    },\n    \/\/\u6587\u5b57\u306e\u80cc\u666f\u8272\u3092\u8a2d\u5b9a\n    background: true,\n    backgroundPadding: [8, 8, 8, 8],\n    getBackgroundColor: [217, 234, 236],\n    \/\/\u30c6\u30ad\u30b9\u30c8\u8a2d\u5b9a\n    getText: (d) =&gt; d.properties.label,\n    getColor: [116, 76, 76],\n    getSize: 32,\n    getAngle: 0,\n    fontWeight: \"bold\",\n    sizeScale: 0.6,\n    characterSet: charaSet \/\/\u751f\u6210\u3057\u305f\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u30bb\u30c3\u30c8\u3092deck.gl\u306b\u6e21\u3059\n  });\n<\/pre><\/div>\n\n\n\n<p>\u3053\u308c\u3067\u65e5\u672c\u8a9e(UTF-8)\u306e\u6587\u5b57\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u7d75\u6587\u5b57\u3082 characterSet\u306b\u767b\u9332\u3059\u308c\u3070\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u7d75\u6587\u5b57\u30de\u30c3\u30d7\u306a\u3069\u3092\u4f5c\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u306a\u304a\u3001\u767b\u9332\u3059\u308b\u6587\u5b57\u304c\u5897\u3048\u308b\u307b\u3069\u51e6\u7406\u304c\u91cd\u304f\u306a\u308a\u30e1\u30e2\u30ea\u3092\u5727\u8feb\u3059\u308b\u306e\u3067\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p><\/p>\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":7770,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-7660","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\/7660","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=7660"}],"version-history":[{"count":12,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7660\/revisions"}],"predecessor-version":[{"id":7778,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7660\/revisions\/7778"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/7770"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=7660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=7660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=7660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}