Open hfu opened 6 years ago
※ちなみに、昨今の状況に合わせ、バイナリベクトルタイルの拡張子は、今後生成するものは pbf に統一しようとしているところ。
※ArcGIS API for JavaScript はstyle.json内のcenter, zoomを解釈しないことに対してどのように一貫性をとりにいくかも課題。むしろ、外してしまった方がスッキリするかもしれない。style.json には interoperable なことしか記述しないという考え方になる。他方で、center や zoom がないと収拾がつかないアプリケーションもあるかもしれない。翻って、center や zoom を用意することが一定の負担になっているのも事実。正しく管理されづらい数値の温床になる。
もっと node っぽくするほうがいいのだろう。多分、こんな感じ。
const bright = require('./bright.js')
const thematic = require('./thematic.js')
const sources = {
openmaptiles: {
template: 'https://hfujimura.gitlab.io/som1801/{z}/{x}/{y}.mvt',
attribution: '© OpenMapTiles © OpenStreetMap contributors',
maxzoom: 14
},
some: {
template: '...',
attribution: '...',
maxzoom: 14
}
}
console.log(JSON.stringify(style({
hash: "#4.95/5.16/46.15",
sources: sources,
layers: bright.concat(thematic)
}), null, 2))
https://github.com/hfu/style/blob/master/index.js たぶん、こんな風に作っていくのだろう。
おそらく、オープン環境ではこれを作り込む機会がないので、これで実質上本件はクローズとする。
これ、今は hjson でやっている。 https://github.com/hfu/macrostyle
考え方
打鍵数を最小化し、再利用率を最大化したい。
ラフスケッチ
例えば、https://github.com/hfu/som1801-bright/blob/master/style.json を生成する元としてこれを作る。
この JSON から、気の利いたデフォルトを使って style.json を組み上げていけば良い。ファイル名重要だね、そうだね、例えば sty.json としようか。sty.json から style.json が make されるものと考えよう。
挙動