npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@geolonia/gsi-mbtiles-tool

v0.0.11

Published

国土地理院が公開している地図タイルをmbtilesに直接ダウンロードし、差分更新できるツールです。

Downloads

15

Readme

@geolonia/gsi-mbtiles-tool

国土地理院が公開している地図タイルをmbtilesに直接ダウンロードし、差分更新できるツールです。

このツールは地理院が公開しているいくつかの資料のもとに作られています。

このツールはまだベータ版です。今後追加していきたい機能や改善は GitHub Issues でご確認ください

使い方

npm install -g @geolonia/gsi-mbtiles-tool
gsi-mbtiles-tool [id]

または

npx @geolonia/gsi-mbtiles-tool [id]

詳細なオプション(出力ファイル指定、ズームレベルフィルター)は gsi-mbtiles-tool --help を参照してください。

[id] にはタイル一覧xyz/[id]/{z}/{x}/{y}.png[id] と指します。

現在、あらかじめメタ情報を指定する必要があるので、 src/etc/gsi_tilesets.ts をご確認ください。

注意: mokuroku をメモリー内に保存するので、特にタイル数が多いタイルセットはOOMで死ぬ場合もあります。その場合、 env NODE_OPTIONS="--max_old_space_size=10000" gsi-mbtiles-tool ... などで領域解放できます。

仕組み

地理院が公開しているタイルには、全て mokuroku.csv というファイルが公開されていて、全てのタイルやそのタイルの MD5ハッシュを格納しています。

このツールは、 mbtiles に md5 をキーとしてタイル情報を格納し、 z/x/y を md5 にマッピングした形で保存されます。このため、重複するタイル(例えば100%白や100%透明など)が二重にダウンロードや保管されず、保存とダウンロード容量が節約できます。

mbtiles のファイルが既に存在する場合は、既に入っていない md5 のタイルのみダウンロードし、 z/x/y と md5 のマッピングを同期します。

earthhillshade (z0-8, 1.5GB) の場合、著者の環境では新しくダウンロードするために約4分かかり、その同じ mbtiles に更新をかける時は5秒ぐらいかかります。

新規作成時の例

> yarn build && node dist/bin/run.js earthhillshade
earthhillshade: 0.028ms Starting up 陰影起伏図(全球版)...
earthhillshade: 437.914ms mokuroku に 87381 件のタイルが認識しました
earthhillshade: 452.885ms mokuroku に 34039 件のユニークなタイルを認識しました。
earthhillshade: 10.464s [タイルダウンロード] remaining=32752 newlyInserted=1267 total=34039
earthhillshade: 20.464s [タイルダウンロード] remaining=31585 newlyInserted=2434 total=34039
earthhillshade: 30.464s [タイルダウンロード] remaining=30248 newlyInserted=3771 total=34039
earthhillshade: 40.464s [タイルダウンロード] remaining=28770 newlyInserted=5249 total=34039
earthhillshade: 50.464s [タイルダウンロード] remaining=27392 newlyInserted=6627 total=34039
earthhillshade: 1:00.464 (m:ss.mmm) [タイルダウンロード] remaining=25952 newlyInserted=8067 total=34039
earthhillshade: 1:10.463 (m:ss.mmm) [タイルダウンロード] remaining=24740 newlyInserted=9279 total=34039
earthhillshade: 1:20.464 (m:ss.mmm) [タイルダウンロード] remaining=22684 newlyInserted=11335 total=34039
earthhillshade: 1:30.464 (m:ss.mmm) [タイルダウンロード] remaining=21157 newlyInserted=12862 total=34039
earthhillshade: 1:40.465 (m:ss.mmm) [タイルダウンロード] remaining=19785 newlyInserted=14234 total=34039
earthhillshade: 1:50.465 (m:ss.mmm) [タイルダウンロード] remaining=18313 newlyInserted=15706 total=34039
earthhillshade: 2:00.466 (m:ss.mmm) [タイルダウンロード] remaining=16687 newlyInserted=17332 total=34039
earthhillshade: 2:10.466 (m:ss.mmm) [タイルダウンロード] remaining=15221 newlyInserted=18798 total=34039
earthhillshade: 2:20.466 (m:ss.mmm) [タイルダウンロード] remaining=13400 newlyInserted=20619 total=34039
earthhillshade: 2:30.467 (m:ss.mmm) [タイルダウンロード] remaining=11596 newlyInserted=22423 total=34039
earthhillshade: 2:40.467 (m:ss.mmm) [タイルダウンロード] remaining=9844 newlyInserted=24175 total=34039
earthhillshade: 2:50.467 (m:ss.mmm) [タイルダウンロード] remaining=7902 newlyInserted=26117 total=34039
earthhillshade: 3:00.467 (m:ss.mmm) [タイルダウンロード] remaining=5790 newlyInserted=28229 total=34039
earthhillshade: 3:10.467 (m:ss.mmm) [タイルダウンロード] remaining=3990 newlyInserted=30029 total=34039
earthhillshade: 3:20.467 (m:ss.mmm) [タイルダウンロード] remaining=2053 newlyInserted=31966 total=34039
earthhillshade: 3:30.467 (m:ss.mmm) [タイルダウンロード] remaining=423 newlyInserted=33596 total=34039
earthhillshade: 3:33.243 (m:ss.mmm) 34039 件の新しいタイルを mbtiles に格納しました
earthhillshade: 3:43.243 (m:ss.mmm) [タイル同期] current=32889 total=87381
earthhillshade: 3:53.242 (m:ss.mmm) [タイル同期] current=65498 total=87381
earthhillshade: 4:00.123 (m:ss.mmm)

[タイルダウンロード][タイル同期] はそれぞれ、進捗を毎10秒に報告します。

更新時の例

> yarn build && node dist/bin/run.js earthhillshade
earthhillshade: 0.027ms Starting up 陰影起伏図(全球版)...
earthhillshade: 278.526ms mokuroku に 87381 件のタイルが認識しました
earthhillshade: 294.656ms mokuroku に 34039 件のユニークなタイルを認識しました。
earthhillshade: 1.057s 0 件の新しいタイルを mbtiles に格納しました
earthhillshade: 4.744s

ライセンス

  • MIT

このリポジトリに含まれるソースコードのライセンスは MIT としますが、成果物のタイルをご利用になる場合は、測量法第29条(複製)、第30条(使用)に基づき国土地理院長への承認申請が必要になる可能性がありますので、ご注意ください。

https://www.gsi.go.jp/LAW/2930-index.html