世界の測量

Sibling of "Relevant, Timely, and Accurate, " but much lighter and shorter ※自らの所属する組織の見解を示すものでない

OS Xでの問題を迂回してvagrant-webmapsでTileStacheを手に入れる

vectiles mix-in: GeoJSON タイルによるパブリックデータのミックスイン - 世界の測量 で名前だけ出てきた TileStache を手元の OS X で動かそうとしたところ、Python的な理由で動かなかったので、perrygeo/vagrant-webmaps · GitHub に迂回して、動作する TileStache を手に入れたという話です。

手元のpythonでTileStacheを動かすとhash collisionが発生すること。

手元のpython(which python すると /usr/local/bin/python となることから、home-brew起源の python だろうと思います)で、pip install tilestache し、例えば tilestache-render.py を動作させようとすると、次のようなエラーが出ます。

$ tilestache-render.py 
AccessInit: hash collision: 3 for both 1 and 1

このエラーについて調べてみると、Pythonの書き方に起因する問題のようです。

vagrant-webmapsを導入すること。

それでは大きく迂回して、perrygeo/vagrant-webmaps · GitHub を使うことにしましょう。私の場合、vagrantとvirtualboxについては、CKAN関係の作業をした時に手に入っていますから、行った作業は、vagrant-webmaps をチェックアウトし、vagrant up してしばらく待つだけです。準備ができたら、次のようにして、TileStache が健全に動作していることを確認できました。

$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

 * Documentation:  https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.

vagrant@precise32:~$ tilestache-render.py 
Usage: tilestache-render.py [options] [coord...]

Each coordinate in the argument list should look like "12/656/1582.png", similar
to URL paths in web server usage. Coordinates are processed in order, each one
rendered to an image file in a temporary location and output to stdout in order.

Configuration and layer options are required; see `tilestache-render.py --help` for info.

tilestache-render.py: error: Missing required configuration (--config) parameter.
vagrant@precise32:~$ 

次にやるべき作業

次にやるべき作業は、TileStache: Generate [Topo|Geo]JSON Vector Tiles - mattmakesmaps を参考にするなどして、ベクトルタイルデータを作成してみることだと思っています。