ããã¯ベクトルタイル Advent Calendar 2017 9æ¥ç®ã®è¨äºã§ãã
hfuããã®è¨äºã§ãã¯ãã«ã¿ã¤ã«ã®ç解ãæ·±ã¾ã£ã¦ããã®ã§ããã®ã¸ãã§å®éã«QGISã使ã£ã¦ãã¯ãã«ã¿ã¤ã«ãè¦ã¦ã¿ã¾ãããã
ãã¯ãã«ã¿ã¤ã«ã¯WebGISçéã§æ´åãé²ãã§ãã¾ããããããã«ãªã£ã¦ãã¹ã¯ãããGISã¸ã®é輸å
¥ãå§ã¾ã£ã¦ããããã§ãã
ArcGIS Pro:
https://pro.arcgis.com/ja/pro-app/help/data/services/use-vector-tiled-layers.htm
QGIS:
https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin
ã¨ãããã¨ã§ãä»åã¯ãã¤ããªãã¯ãã«ã¿ã¤ã«ãQGISã§è¡¨ç¤ºãã¦ã¿ã¾ãã
QGISã§ãã¤ããªãã¯ãã«ã¿ã¤ã«ã表示ãã¦ã¿ã
QGISã§ãã¤ããªãã¯ãã«ã¿ã¤ã«ã表示ããã«ã¯ãVector Tiles Reader Pluginã使ç¨ãã¾ããQGIS 2.18以ä¸ã§åä½ãã¾ãã
1. QGIS 2.18ã«Vector Tiles Reader Pluginãå ¥ãã¾ãã
ãã©ã°ã¤ã³ã®ç®¡çã®è¨å®ç»é¢ã§ããå®é¨çãã©ã°ã¤ã³ã表示ãããã«ãã§ãã¯ãå
¥ããã¨ãªã¹ãã«è¡¨ç¤ºããã¾ãã
2. ã¡ãã¥ã¼ãã ãã¯ã¿ > Vector Tiles Layer > Add Vector Tiles Layer..ã¨é¸ã³ã¾ãã
ããã©ã«ãã§ã以ä¸ã®Oãã¯ãã«ã¿ã¤ã«ã®é ä¿¡ãã¼ã¿ãã»ããããã¦ãã¾ãã
- Mapzen.com
- OpenMapTiles.com
- OpenMapTiles.com(with custom key)
ããã¯OSMã®ãã¼ã¿ããã¯ãã«ã¿ã¤ã«ã«å¤æãããã®ã§ãMapzenãã¼ã¸ã§ã³ãOpenMapTilesãã¼ã¸ã§ã³ãé¸æã§ãã¾ãã
ä½ãéãã®ãã¯hfuããã®ãã¡ãã®è¨äºãåèã«ãªãã¾ãã
https://qiita.com/hfu/items/a761c5875d73c164bcd4
https://qiita.com/hfu/items/afbafacb70197711ee29
3. ãConnectããæ¼ãã¦ã¬ã¤ã¤æ å ±ãåå¾ãã¾ãã
ã¬ã¤ã¤ã®ä¸è¦§ã表示ããã表示ãªãã·ã§ã³ãè¨å®ã§ãã¾ãã
表示ãªãã·ã§ã³ã¯ããBase Map defaultsãããAnalysys DefaultsãããInspection DefaultsãããManualããã»ããããã¦ãã¾ãã
- Base Map defaultsï¼è¡¨ç¤ºç¨ãJSONã®ã¹ã¿ã¤ã«ãé©ç¨ã32ã¿ã¤ã«ãèªã¿è¾¼ã¿
- Analysys Defaultsï¼åæç¨ãã¿ã¤ã«ã®å¢çãããã¡é¨åãåãåãããã¹ã¦ã®ã¿ã¤ã«ããã¼ã¸ã16ã¿ã¤ã«èªã¿è¾¼ã¿
- Inspection Defaultsï¼ç¢ºèªç¨ã1ã¿ã¤ã«ã®ã¿èªã¿è¾¼ã¿ã
- Manualï¼èªåã§ãªãã·ã§ã³ãè¨å®
4. ãAddããã¿ã³ãæ¼ãã¦ã表示ãã¾ãã
ãã£ãããã ãã§ãå ¨å½ç·¨éå¯è½ãªOSMã®ãã¼ã¿ãåå¾ã§ãã¦ãã¾ãã¾ãããã¯ãã«ã¿ã¤ã«ä¾¿å©ã§ããã¼
â»ã¡ãã£ã¨åã«è©¦ããæã¯ãããã©ã«ãã®ã¹ã¿ã¤ã«ãããæãã§ä»ãã¦ããã¦ããã©ãä»æ¥ããã©ã°ã¤ã³ãã¢ãããã¼ããããããã¾ãã¡ãªã¹ã¿ã¤ã«ã«ãªã£ã¦ã¾ãããã¾ãããã®ã¸ãã¯éçºéä¸ã¨ãããã¨ã§ã
ãããªã£ã¦ããã¨ãã¯ãã«ã¿ã¤ã«ãèªåã§ä½ã£ã¦ãQGISã§è¡¨ç¤ºãããããªãã¾ãã
ã¨ãããã¨ã§ããã
shpãã¡ã¤ã«ãããã¤ããªãã¯ãã«ã¿ã¤ã«ãä½ã
èªåã®shpãã¡ã¤ã«ãããã¤ããªãã¯ãã«ãã¡ã¤ã«ãä½ã£ã¦ã¿ã¾ãããã
1. shpãã¡ã¤ã«ãç¨æãã¾ãã
ä»åã¯ãæ¤çå³ã®ãã¼ã¿ãå©ç¨ãã¾ããã
http://gis.biodic.go.jp/webgis/sc-023.html
2. shpãã¡ã¤ã«ãgeojsonã«å¤æãã¾ãã
QGISã§geojsonå½¢å¼ã§æ¸ãåºãã°OKã§ãã
3. tippecanoeãç¨æãã¾ãã
Windowsã§tippecanoeãå©ç¨ããããã«ãBash on Ubuntu on Windowsãå
¥ãã¦ããã¾ããã¤ã³ã¹ãã¼ã«æ¹æ³ã¯ã°ã°ã£ã¦ãã ããã
tiooecanoeã®ã½ã¼ã¹ã³ã¼ãããã¦ã³ãã¼ããã¾ãã
https://github.com/mapbox/tippecanoe
bashã³ã³ã½ã¼ã«ã§git cloneãããã°ãã¦ã³ãã¼ãã§ãã¾ãã
git clone https://github.com/mapbox/tippecanoe.git
tippecanoeãã³ã³ãã¤ã«ãã¾ããã³ã³ãã¤ã«ã«å¿
è¦ãªã½ãããapt-getã§ã¤ã³ã¹ãã¼ã«ãã¦ããmakeãã¾ãã
cd tippecanoe sudo apt-get install make g++ sqlite3 libsqlite3-dev zlib1g-dev make sudo make install
6. tippecanoeã§geojsonãpbf(mvt)ã«å¤æãã¾ãã
以ä¸ã®ã³ãã³ãã§geojsonãpbfãã¡ã¤ã«ã«å¤æãã¾ãããã¡ã¤ã«ã¯vegãã©ã«ãã«1/1/1.pbfã®ããã«ä½ããã¾ããå¤æãªãã·ã§ã³ã§ããºã¼ã ã¬ãã«ãç°¡ç´ åãªã©ãè¨å®ã§ãã¾ãã
tippecanoe -e veg veg.geojson
以ä¸ã®ã³ãã³ãã ã¨ãmbtileså½¢å¼ã«ãªãã¾ãã
tippecanoe -o veg.mbtiles veg.geojson
tippecanoeã§å¤æããã¨æ¡å¼µåã¯pbfã¨ãªãããã§ãããvector-tile-specãèªãã¨mvtã¨ãã¹ãã¿ããã§ããã
https://github.com/madefor/vector-tile-spec/blob/master/2.1/README.md
ãã¤ããªãã¯ãã«ã¿ã¤ã«ããããã§é ä¿¡ãã¦QGISã§è¡¨ç¤ºãã
ãã¤ããªãã¯ãã«ã¿ã¤ã«ãã§ããã®ã§QGISã§èªã¿è¾¼ããããã«é
ä¿¡ãã¦ã¿ã¾ãããã
1. ã¬ã¤ã¤æ å ±ã®tile.jsonãä½æãã¾ãã
Vector Tiles Reader Pluginã«ã¬ã¤ã¤ã®æ å ±ãæããããã«ãtilejsonå½¢å¼ã®tile.jsonãä½æãã¾ãã
https://github.com/mapbox/tilejson-spec/tree/master/2.2.0
tilejsonã®specã¯ãªã³ã¯ã®éãã§ããããã©ã°ã¤ã³ã§ã¯æä½éã®æ
å ±ãããã°å¤§ä¸å¤«ããã§ãã
tilesã®URLã¯ãé
ä¿¡å ´æã®URLã«åããã¾ããboundsãcenterã¯tippecanoeã§å¤æãããvegãã©ã«ãã®ä¸ã®metadata.jsonã«æ¸ããã¦ãã¾ãã
ãããªæãã§ãã
{ "tilejson": "2.2.0", "tiles": ["https://map.ecoris.info/mvt-tiles/veg/{z}/{x}/{y}.pbf"], "name": "veg mvt", "attribution": "Biodiversity Center of Japan", "maxzoom": 14, "minzoom": 0, "bounds": [140.746596,37.836344,140.871589,37.919672], "center": [140.767822,37.848832,14], "vector_layers": [{ "id": "veg", "description": "vegetation data (Biodiversity Center of Japan)", "maxzoom": 14, "minzoom": 0 }] }
2. ãã¼ã¿ããµã¼ãã¼ã«ã¢ãããã¼ããã¾ãã
tile.jsonãvegãã©ã«ãã®ä¸ã«å
¥ãã¦ãã¦ã§ããµã¼ãã¼ã«ã¢ãããã¼ããã¾ãã
3. ãã©ã°ã¤ã³ã«ã¿ã¤ã«æ å ±ãç»é²ãã¾ãã
QGISã®ã¡ãã¥ã¼ãããã¯ã¿ > Vector Tiles Layer > Add Vector Tiles Layer..ã§ãNewããé¸æãã¦ãNameã¨tile.jsonã®URLãç»é²ãã¾ããä»ã®ã¨ããNameã«æ¥æ¬èªã¯å ¥ãããã¾ããã
- Nameï¼ veg
- Tile Json URLï¼ https://map.ecoris.info/mvt-tiles/veg/tile.json
- GL JSON Stle URLï¼ç©ºç½ï¼ã¹ã¿ã¤ã«è¨å®ã¯ãã¾ã 試ãã¦ã¾ããï¼
4. Connectãã¦Addãã¦è¡¨ç¤ºãã¾ãã
ããã§èªåã®ãã¯ãã«ã¿ã¤ã«ã表示ããã¾ãããã¯ãã«ã¿ã¤ã«ãªã®ã§ãèªåã®å¥½ããªããã«çè²ãããç·¨éã§ãã¾ããèªã¿è¾¼ã¿ãªãã·ã§ã³ã§çµåãã¦ããªãå ´åã¯ãå¢çé¨åã®ãããã¡ã¼ã«éãªããããã¾ãã
ãã¾ããgithubä¸ã®ãã¯ãã«ã¿ã¤ã«ãQGISã§èªã¿è¾¼ã
hfuãããgithubã§ãã¯ãã«ã¿ã¤ã«ãå ¬éããã¦ããã®ã§ããããQGISã§èªã¿è¾¼ãã§ã¿ã¾ãã
試ãã«ããã®ãã¯ãã«ã¿ã¤ã«ã表示ãã¦ã¿ã¾ãã
https://github.com/hfu/chome-vt
èªåã®gistã§ã¬ã¤ã¤æ
å ±ãä½æãã¾ãã
https://gist.github.com/tmizu23/5d427e657e6553c361881a3ec16683ed
RAWãã¿ã³ãæ¼ãã¦ããã®URLããã©ã°ã¤ã³ã®ã¿ã¤ã«æ å ±ã®Tile Json URLã«è¨å®ãã¾ãã
- Nameï¼ chome-vt
- Tile Json URLï¼ https://gist.githubusercontent.com/tmizu23/5d427e657e6553c361881a3ec16683ed/raw/6677e5afa8385e1e5d60699855b0e6b6ef772cba/test.json
- GL JSON Stle URLï¼ç©ºç½ï¼ã¹ã¿ã¤ã«è¨å®ã¯ãã¾ã 試ãã¦ã¾ããï¼
ãã¡ãããå±æ§ã®ã©ãã«ã表示ã§ãã¾ãã
ãã¾ããmbtilesãQGISã§èªã¿è¾¼ã
tippecanoeã§mbtilesã«å¤æããå ´åããVector-Tiles-Readerã§è¡¨ç¤ºã§ãã¾ãã
QGISã®ã¡ãã¥ã¼ãããã¯ã¿ > Vector Tiles Layer > Add Vector Tiles Layer..ã§ãMBTilesãã¿ããé¸æãã¦ããã¡ã¤ã«ãé¸ã¹ã°OKã§ãã
â»pbfããDirectorisãã¿ãã§èªã¿è¾¼ããã¯ãã§ãããå±æ§ã«æ¥æ¬èªãããã¨metadata.jsonã®èªã¿è¾¼ã¿ã§ã¨ã©ã¼ã«ãªãããã§ããï¼ãã£ã¡ã¯metadata.jsonãåç
§ããããã§ããï¼
ã¾ã¨ã
ãã¤ããªãã¯ãã«ã¿ã¤ã«ãQGISã§ãã¼ã¿ãåå¾ã表示ã§ããããã«ãªã£ã¦ãã¾ããããã¯ãã«ã¿ã¤ã«ã¯ããã¼ã¿ãã®ãã®ãªã®ã§ãç·¨éãçè²ãèªç±ã«ã§ãã¾ããWebGISç¨ã¨æããã¦ãããã¯ãã«ã¿ã¤ã«ã§ããããã®æ©æµã¯ãã¹ã¯ãããGISã«ãããããã§ãããã¤ããªãã¯ãã«ã¿ã¤ã«ã®æ®åãé²ãã§ãçãã¨ã®shpãã¡ã¤ã«ãå¥ã ã«ãã¦ã³ãã¼ããã¦ã解åãã¦ãçµåãã¦ã¿ãããªé¢åãªãã¨ãããªãã¦æ¸ãããã«ãªãã¨è¯ãã§ãã;-)
ï¼ããããã°ãWFSã£ã¦ã®ãæãã£ãæ°ããã¾ãããã©ããªã£ããã§ãããã¼ï¼ï¼
æ¥é±ã¯ãVector-Tiles-Readerã®ã½ã¼ã¹ã³ã¼ãã移æ¤ãã¦ãRã§ãã¤ããªãã¯ãã«ã¿ã¤ã«ãèªã¿è¾¼ããããã«ãã¦ã¿ããã¨æãã¾ãã
ã§ã¯ãã¾ãã