LoginSignup
2
1

More than 5 years have passed since last update.

コミュニティドリブンのウェブ地図「sandmaps」について

Posted at

gsimapsのワイルドなフォークsandmaps

国土地理院はウェブ地図「地理院地図」のソースコードを https://github.com/gsi-cyberjapan/gsimaps で公開しています。こちらでは、国土地理院によって運営されている地理院地図が管理されています。

一方で、世の中のITは進んでいます。すぐには地理院運用に回せない技術についてプルリクエストがあったこと(https://github.com/gsi-cyberjapan/gsimaps/pull/74 )をきっかけに、地理院地図のサンドボックス的なレポジトリが生まれました。こちらは sandmaps という名前で https://github.com/sandmaps/sandmaps.github.io というレポジトリで管理されています。sandmaps は、地理院運用には時期尚早なものを含めて、新しい試みをワイルドに実施することを方針としています。

sandmaps の運営主体は地理院ではなく The Sandmaps Project というコミュニティであり、sandmaps はコミュニティドリブンな運営を目指しています。

マニフェスト

sandmaps のマニフェストについては、https://github.com/sandmaps/sandmaps.github.io/wiki/design%20principle に記載されています。ここでは、その項目のみ再掲します。

  • if the geeks shall inherit the gsimaps
  • sandmaps is a sandbox
  • always choose the wilder option
  • simpler is better, smaller is better
  • open
  • don't be evil. do the right thing
  • laziness, impatience, hubris
  • fitter, happier, more productive, comfortable
  • YAGNI (sandmaps is a showcase)
  • always live on the edge

技術的な特徴

現在時点の sandmaps の技術的な特徴は、次の2点です。

モダンな管理

miya0001 さんの尽力により、かなりモダンな管理が実現しています。

Travis CI を用いた自動構築・自動デプロイ

Travis CI を使用して、master に変更を反映すると、自動的に必要な npm モジュールを持ってきてスクリプトを minify & uglify し、gh-pages にデプロイするようになっています。

see https://github.com/sandmaps/sandmaps.github.io/pull/8

Travis CI のバッジ敷設

Travis CI での処理結果を表示するバッジを README に追加し、ビルド状況がわかるようになっています。→ https://github.com/sandmaps/sandmaps.github.io/blob/master/README.md

see https://github.com/sandmaps/sandmaps.github.io/pull/9

エディタのインデントの統一、テスト

.editorconfig により、エディタのインデント設定等を統一しています。sandmaps では、Ruby の流儀を過剰に採用して、JavaScript でも「ソフト2タブ」としています。

また、https://github.com/sandmaps/sandmaps.github.io/blob/master/tests/tests.js にあるように、テストを導入しています。現在のところ、テストの内容はそれほど多くはありませんが、それでも gsimaps.js の修正ミスでヘッダが空白で復活するなどのエラーを捉えることに成功したりしています。

see https://github.com/sandmaps/sandmaps.github.io/pull/10

コンパクトなスクリプト

sandmaps が gsimaps から引き継いで保持しようとする最も重要な機能は「layers.txt」https://github.com/gsi-cyberjapan/layers-dot-txt-spec を使って様々なタイルデータを重ね合わせる機能です。それ以外の機能は、一度すべて削ぎ落としてしまい、その結果、Leaflet 1.0 のような新技術への対応余地を見出すことができればと思っています。

このため、スクリプトを大幅に削除する試みをしています。

スクリプト削除の究極系は frogcat さんのフォーク https://github.com/frogcat/sandmaps.github.iohttp://frogcat.github.io/sandmaps.github.io/ が「スクラッチから作る」というアプローチですでに示されていますが、sandmaps 本体では、gsimaps からスクリプトを削っていくというアプローチを実施中です。

gsimapsとsandmapsの主要な JavaScript ファイルと CSS ファイルの大きさを比較すると、次の通りです。

gsimaps sandmaps
JavaScript js/gsimaps.js 632KB js/gsimaps.min.js 138KB
CSS css/gsimaps.css 79KB css/gsimaps.css 70KB

sandmaps の JavaScript はかなり小さいですが、この値は minify & uglify をした結果であることに留意は必要です。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1