{"id":7603,"date":"2021-12-21T10:28:56","date_gmt":"2021-12-21T01:28:56","guid":{"rendered":"https:\/\/gunmagisgeek.com\/blog\/?p=7603"},"modified":"2021-12-21T10:29:45","modified_gmt":"2021-12-21T01:29:45","slug":"deck-gl%e3%81%a7%e5%9c%b0%e7%90%83%e5%84%80%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\/7603","title":{"rendered":"deck.gl\u3067\u5730\u7403\u5100\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\u00a0<\/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\u306fview\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u30c7\u30d5\u30a9\u30eb\u30c8\u306eWeb\u30e1\u30eb\u30ab\u30c8\u30eb\u56f3\u6cd5\u306e\u5730\u56f3\u4ee5\u5916\u306e\u6295\u5f71\u6cd5\u3092\u4f7f\u3063\u3066\u63cf\u753b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u65b0\u305f\u306b\u8ffd\u52a0\u3055\u308c\u305fglobe view\u3092\u4f7f\u3063\u3066\u5730\u7403\u5100\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-gldedi-qiu-yi-wobiao-shi-suru-omfjl?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\u3067\u5730\u7403\u5100\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>\u57fa\u672c\u7684\u306b\u306f\u3001deck.gl\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306eviews\u30d7\u30ed\u30d1\u30c6\u30a3\u306bGlobeView\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6e21\u3057\u3066\u4e0a\u3052\u308b\u3060\u3051\u3067\u5730\u7403\u5100\u306e\u3088\u3046\u306b\u30d9\u30fc\u30b9\u30de\u30c3\u30d7\u3084\u30ec\u30a4\u30e4\u30fc\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3057\u3001GeoJSON\u30ec\u30a4\u30e4\u30fc\u306f\u305d\u306e\u307e\u307e\u3060\u3068\u30d9\u30fc\u30b9\u30de\u30c3\u30d7\u306e\u88cf\u5074\u306b\u56de\u3063\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u9ad8\u3055\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u3001\u30d9\u30fc\u30b9\u30de\u30c3\u30d7\u3092\u8868\u793a\u3057\u3066\u3044\u308btileLayer\u3067\u306f\u3001\u30b5\u30d6\u30ec\u30a4\u30e4\u30fc\u306eBitmapLayer\u3067\u65b0\u305f\u306b\u5ea7\u6a19\u7cfb\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u8a2d\u5b9a\u3092\u304a\u3053\u306a\u308f\u306a\u3044\u3068\u4f4d\u7f6e\u304c\u30ba\u30ec\u3066\u3057\u307e\u3046\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js mark:5,13-16 decode:true \" title=\"App.js\">import React, { useEffect, useState } from \"react\";\nimport DeckGL, {\n  MapController,\n  \/\/globview\u3092\u8aad\u307f\u8fbc\u3080(\u307e\u3060experimental\u306a\u306e\u3067\u30a2\u30f3\u30c0\u30fc\u30d0\u30fc\u304c\u3064\u3044\u3066\u3044\u307e\u3059)\n  _GlobeView as GlobeView\n} from \"deck.gl\";\n\nconst App = () =&gt; {\n\n  \/\/\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\n  return (\n      &lt;DeckGL\n        views={\n          \/\/GlobeView\u3092\u9069\u7528\u3059\u308b\n          new GlobeView()\n        }\n      \/&gt;\n  );\n};\n\nexport default App;\n<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js mark:2,16,38 decode:true \" title=\"RenderLayers.js\">import {\n  COORDINATE_SYSTEM \/\/\u30d3\u30eb\u30c8\u30a4\u30f3\u3055\u308c\u3066\u3044\u308b\u5ea7\u6a19\u7cfb\u3092\u8aad\u307f\u8fbc\u307f\n} from \"deck.gl\";\n\nexport function renderLayers(props) {\n  \/\/\u770c\u5883\u754c\u30c7\u30fc\u30bf\u3092\u53ef\u8996\u5316\n  const geoJSONlayer = new GeoJsonLayer({\n    id: \"geojson-layer\",\n    data: \".\/data\/countries-mini.geojson\",\n    pickable: true,\n    stroked: true,\n    filled: true,\n    wireframe: true,\n    lineWidthMinPixels: 5,\n    extruded: true,\n    getElevation: 30000, \/\/\u9ad8\u3055\u3092\u8a2d\u5b9a\u3057\u306a\u3044\u3068\u30bf\u30a4\u30eb\u306e\u88cf\u306b\u56de\u3063\u3066\u3057\u307e\u3046\u3002\n    getFillColor: [0, 160, 0, 180],\n    getLineColor: [0, 0, 0, 255]\n  });\n\n\n  \/\/OSM\u30bf\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f\u30d9\u30fc\u30b9\u30de\u30c3\u30d7\u3068\u3057\u3066\u8868\u793a\n  const tileLayer = new TileLayer({\n    data: \"https:\/\/c.tile.openstreetmap.org\/{z}\/{x}\/{y}.png\",\n    minZoom: 0,\n    maxZoom: 19,\n    tileSize: 256,\n\n    renderSubLayers: (props) =&gt; {\n      const {\n        bbox: { west, south, east, north }\n      } = props.tile;\n\n      return new BitmapLayer(props, {\n        data: null,\n        image: props.data,\n        \/\/\u753b\u50cf(\u30bf\u30a4\u30eb)\u3092\u76f4\u4ea4\u5ea7\u6a19\u7cfb\u3067\u914d\u7f6e\u3059\u308b\n        _imageCoordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n        bounds: [west, south, east, north]\n      });\n    }\n  });\n\n  return [tileLayer, geoJSONlayer];\n}\n<\/pre><\/div>\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":7864,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-7603","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\/7603","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=7603"}],"version-history":[{"count":8,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7603\/revisions"}],"predecessor-version":[{"id":7865,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7603\/revisions\/7865"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/7864"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=7603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=7603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=7603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}