{"id":8323,"date":"2024-01-04T21:32:59","date_gmt":"2024-01-04T12:32:59","guid":{"rendered":"https:\/\/gunmagisgeek.com\/blog\/?p=8323"},"modified":"2024-05-23T16:07:25","modified_gmt":"2024-05-23T07:07:25","slug":"%e6%b1%8e%e7%94%a8%e7%9a%84%e3%81%aa%e5%9c%b0%e7%90%86%e7%a9%ba%e9%96%93%e3%83%87%e3%83%bc%e3%82%bf%e3%83%ad%e3%83%bc%e3%83%80%e3%83%bc%e3%80%8cloaders-gl%e3%80%8d%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6p","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/8323","title":{"rendered":"\u6c4e\u7528\u7684\u306a\u5730\u7406\u7a7a\u9593\u30c7\u30fc\u30bf\u30ed\u30fc\u30c0\u30fc\u300cloaders.gl\u300d\u3092\u4f7f\u3063\u3066PMTiles\u30d5\u30a1\u30a4\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30c9\u3059\u308b"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u6982\u8981<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/protomaps\/PMTiles\" data-type=\"link\" data-id=\"https:\/\/github.com\/protomaps\/PMTiles\">PMTiles<\/a>\u306f\u3001\u30bf\u30a4\u30eb\u5316\u3055\u308c\u305f\u5730\u7406\u7a7a\u9593\u30c7\u30fc\u30bf\u3092\u5358\u4e00\u30d5\u30a1\u30a4\u30eb\u3067\u914d\u4fe1\u3067\u304d\u308b\u30d5\u30a1\u30a4\u30eb\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3059\u3002<br>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u4e00\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u306b\u53ce\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u3066\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3059\u306b\u306fHTTP Range\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u7528\u3044\u305f\u8907\u96d1\u306a\u51e6\u7406\u304c\u5fc5\u8981\u3060\u3063\u305f\u305f\u3081\u3001PMTiles\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u5730\u56f3\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u6271\u3046\u306e\u304c\u56f0\u96e3\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3057\u304b\u3057\u3001\u69d8\u3005\u306a\u5730\u7406\u7a7a\u9593\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\u305f\u3081\u306e\u6c4e\u7528\u30c4\u30fc\u30eb\u3067\u3042\u308b\u300c<a href=\"https:\/\/loaders.gl\/\" data-type=\"link\" data-id=\"https:\/\/loaders.gl\/\">loaders.gl<\/a>\u300d\u304c<a href=\"https:\/\/loaders.gl\/docs\/modules\/pmtiles\/formats\/pmtiles\" data-type=\"link\" data-id=\"https:\/\/loaders.gl\/docs\/modules\/pmtiles\/formats\/pmtiles\">PMTiles\u5f62\u5f0f\u306b\u5bfe\u5fdc<\/a>\u3057\u305f\u306e\u3067\u3001PMTiles\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3059\u3053\u3068\u304c\u975e\u5e38\u306b\u7c21\u5358\u306b\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3053\u3053\u3067\u306f\u3001loaders.gl\u3092\u4f7f\u3063\u3066PMTiles\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3059\u65b9\u6cd5\u3068\u3001deck.gl\u3092\u4f7f\u3063\u3066\u53d6\u308a\u51fa\u3057\u305f\u30c7\u30fc\u30bf\u3092\u53ef\u8996\u5316\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">loaders.gl\u3092\u4f7f\u3063\u3066PMTiles\u30d5\u30a1\u30a4\u30eb\u3092\u30ed\u30fc\u30c9\u3059\u308b<\/h2>\n\n\n\n<p><strong>@loaders.gl\/pmtiles<\/strong>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:zsh decode:true \" title=\"Install\">$ npm install @loaders.gl\/pmtiles<\/pre><\/div>\n\n\n\n<p>\u4ee5\u4e0b\u306f\u3001loaders.lg\u3092\u4f7f\u3063\u3066\u6307\u5b9a\u3057\u305f<a href=\"https:\/\/maps.gsi.go.jp\/development\/tileCoordCheck.html#6\/33.285\/139.823\" data-type=\"link\" data-id=\"https:\/\/maps.gsi.go.jp\/development\/tileCoordCheck.html#6\/33.285\/139.823\">\u30bf\u30a4\u30eb\u5ea7\u6a19<\/a>\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u300c<a href=\"https:\/\/nlftp.mlit.go.jp\/ksj\/gml\/datalist\/KsjTmplt-A17-v4_0.html\" data-type=\"link\" data-id=\"https:\/\/nlftp.mlit.go.jp\/ksj\/gml\/datalist\/KsjTmplt-A17-v4_0.html\">\u56fd\u571f\u6570\u5024\u60c5\u5831\uff1a\u904e\u758e\u5730\u57df\u30c7\u30fc\u30bf<\/a>\u300d\u3092PMtiles\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5909\u63db\u3057\u305f\u30c7\u30fc\u30bf\u3092\u4f7f\u3044\u307e\u3057\u305f\u3002\u30d5\u30a1\u30a4\u30eb\u306f\u79c1\u500b\u4eba\u306eGoogle Strage\u306b\u7f6e\u3044\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 \">import { PMTilesSource } from '@loaders.gl\/pmtiles';\n\nconst loadPmtiles =  async () =&gt;{\n  \/\/PMTile\u30d5\u30a1\u30a4\u30eb\u304c\u7f6e\u3044\u3066\u3042\u308bURL\u3092\u6307\u5b9a\u3059\u308b\n  const tileSource = new PMTilesSource({ url: \"https:\/\/storage.googleapis.com\/g3-open-resource\/MapChallenge2023\/population\/japan_dep.pmtiles\" });\n\n  \/\/\u30bf\u30a4\u30eb\u5ea7\u6a19\u6307\u5b9a\n  const tileReqest = {\n    index: {\n      x: 56,  \/\/ x\u5ea7\u6a19\n      y: 25,  \/\/ y\u5ea7\u6a19\n      z: 6   \/\/ \u30ba\u30fc\u30e0\u30ec\u30d9\u30eb\n    }\n  };\n\n  \/\/\u6307\u5b9a\u3057\u305f\u30bf\u30a4\u30eb\u5ea7\u6a19\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\n  const data = await tileSource.getTileData(tileReqest);\n  console.log(\"\u30e1\u30bf\u30c7\u30fc\u30bf\", tileSource.mimeType); \n  console.log(\"\u30c7\u30fc\u30bf\", data) \n\n  \/\/\u30c7\u30b3\u30fc\u30c9\u3055\u308c\u308b\u524d\u306e\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u4e8b\u3082\u3067\u304d\u308b\n  const rawData = await tileSource.getTile(tileReqest);\n  console.log(\"\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\", rawData) \/\/ArrayBuffer\n}\n\nloadPmtiles();<\/pre><\/div>\n\n\n\n<p><a href=\"https:\/\/loaders.gl\/docs\/modules\/pmtiles\/api-reference\/pmtiles-source\" data-type=\"link\" data-id=\"https:\/\/loaders.gl\/docs\/modules\/pmtiles\/api-reference\/pmtiles-source\">PMTilesSource<\/a>\u30af\u30e9\u30b9\u3092\u4f7f\u3063\u3066tileSource\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001getTileData\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u306b\u30bf\u30a4\u30eb\u5ea7\u6a19\u3092\u6307\u5b9a\u3057\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u308c\u3070\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>PMTiles\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306f\u30d9\u30af\u30bf\u30fc\u30bf\u30a4\u30eb\u4ee5\u5916\u306b\u3082\u30e9\u30b9\u30bf\u30fc\u30bf\u30a4\u30eb\u3082\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u304c\u3001\u8aad\u307f\u8fbc\u3093\u3060PMTiles\u306b\u30d9\u30af\u30bf\u30fc\/\u30e9\u30b9\u30bf\u30fc\u3069\u3061\u3089\u306e\u30c7\u30fc\u30bf\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u304b\u306e\u78ba\u8a8d\u306f\u30e1\u30bf\u30c7\u30fc\u30bf\u3092\u898b\u308b\u3053\u3068\u3067\u5224\u5225\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Deck.gl\u3092\u4f7f\u3063\u3066\u53ef\u8996\u5316\u3057\u305f\u4f8b<\/h2>\n\n\n\n<p>\u6700\u5f8c\u306bDeck.gl\u3068loaders.gl\u3092\u7d44\u307f\u5408\u308f\u305b\u3066PMTiles\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092\u53ef\u8996\u5316\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n\n\n\n<iframe src=\"https:\/\/codesandbox.io\/p\/devbox\/deck-gl-pmtiles-loaders-gl-7kf4rl?embed=1&#038;file=%2Fsrc%2FRenderLayers.js\"\n     style=\"width:100%; height: 500px; border:0; border-radius: 4px; overflow:hidden;\"\n     title=\"deck.gl + PMTiles (loaders.gl)\"\n     allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\"\n     sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n   ><\/iframe>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306bloaders.gl\u3092\u4f7f\u3046\u3068PMTiles\u306e\u30c7\u30fc\u30bf\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Deck.gl\u306eTileLayer\u306e\u3088\u3046\u306b\u30bf\u30a4\u30eb\u5ea7\u6a19\u3092\u51e6\u7406\u3059\u308bAPI\u304c\u7121\u3044\u5730\u56f3\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u3063\u3066\u3082\u3001<a href=\"https:\/\/github.com\/d3\/d3-tile\" data-type=\"link\" data-id=\"https:\/\/github.com\/d3\/d3-tile\">d3-tile<\/a>\u306e\u3088\u3046\u306a\u30bf\u30a4\u30eb\u5ea7\u6a19\u3092\u8a08\u7b97\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3068loaders.gl\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u306a\u3069\u3057\u3066\u3001PMTiles\u306e\u30c7\u30fc\u30bf\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 PMTiles\u306f\u3001\u30bf\u30a4\u30eb\u5316\u3055\u308c\u305f\u5730\u7406\u7a7a\u9593\u30c7\u30fc&hellip;<\/p>\n","protected":false},"author":1,"featured_media":8337,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-8323","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\/8323","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=8323"}],"version-history":[{"count":20,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/8323\/revisions"}],"predecessor-version":[{"id":8378,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/8323\/revisions\/8378"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/8337"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=8323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=8323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=8323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}