Giter Club home page Giter Club logo

kata's Introduction

@unvt/kata

A vector tile design information processing tool

social preview image

About the social preview image

The social preview image is Writing Box with Cranes, Pines, Plum Blossoms, and Characters.

Features

  • Retrieve metadata from metadata.json and display layer information on standard output.
  • Generate ndjson from a YAML configuration file and pass it to tippecanoe as an option.

Example of the YAML config for kata filter command.

kata.yml:

features1:
  source: ./test1.geojson
  properties:
    name: properties["name:ja"]
  minzoom: 8
  maxzoom: 14
features2:
  source: https://gist.githubusercontent.com/miya0001/56c3dc174f5cdf1d9565cbca0fbd3c48/raw/c13330036d28ef547a8a87cb6df3fa12de19ddb6/test.geojson
  properties:
    title: properties.label
  minzoom: 2
  maxzoom: 10

Then you can run kata filter command:

$ kata filter ./kata.yml
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{...},"geometry":{...}, "tippecanoe":{"layer":"features1","minzoom":8,"maxzoom":14}},...]}
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{...},"geometry":{...}, "tippecanoe":{"layer":"features2","minzoom":2,"maxzoom":10}},...]}

Install

$ npm install -g @unvt/kata

How to use

$ kata help
Usage: kata [options] [command]

Options:
  -v, --version                    output the version number
  -h, --help                       display help for command

Commands:
  document <source> [destination]  output the metadata from the <source>
  filter <source>                  output the ndjson from the <source>
  help [command]                   display help for command

Development

$ git clone https://github.com/unvt/kata
$ cd kata
$ npm install
$ npm run build

Then run:

$ npm run command help

Or

$ npm install -g .
$ kata help

License

MIT

kata's People

Contributors

hfu avatar miya0001 avatar ubukawa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ubukawa yuiseki

kata's Issues

FeatureCollection の扱いについて

お世話になります。開発ありがとうございます。
早速、kataのfilterを使ってみました!

複数のgeojsonファイルからndjsonのtippecanoe入力ファイルを作って、それをtippecanoeに入れる実験をしていたのですが、これがFeatureCollectionでラップされているので、tippecanoeにそのまま入力できません。
皆様、どのようにされていますか??

(参考、tippecanoeのreadme usageのところに書いてある文章)
The GeoJSON features need not be wrapped in a FeatureCollection. You can concatenate multiple GeoJSON features or files together, and it will parse out the features and ignore whatever other objects it encounters.

`kata document` doesn't get the correct zoom levels if the tile was built from ndjson

I created a ndjson as test.ndjson:

{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 0, 0 ] }, "tippecanoe": { "layer": "layer1", "minzoom": 0, "maxzoom": 0 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 1, 1 ] }, "tippecanoe": { "layer": "layer2", "minzoom": 1, "maxzoom": 1 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 2, 2 ] }, "tippecanoe": { "layer": "layer3", "minzoom": 2, "maxzoom": 2 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 3, 3 ] }, "tippecanoe": { "layer": "layer4", "minzoom": 3, "maxzoom": 3 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 4, 4 ] }, "tippecanoe": { "layer": "layer5", "minzoom": 4, "maxzoom": 4 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 5, 5 ] }, "tippecanoe": { "layer": "layer6", "minzoom": 5, "maxzoom": 5 } }
{ "type": "Feature", "properties": {}, "geometry": { "type": "Point", "coordinates": [ 6, 6 ] }, "tippecanoe": { "layer": "layer7", "minzoom": 6, "maxzoom": 6 } }

Then run tippecanoe:

$ tippecanoe -o test.mbtiles test.ndjson

We can see tiles in zoom level 0-6 only.
But the test.mbtiles has metadatas as zoom level 0-14 like following.

$ sqlite3 test.mbtiles
SQLite version 3.36.0 2021-06-18 18:58:49
Enter ".help" for usage hints.
sqlite> select * from metadata;
name|test.mbtiles
description|test.mbtiles
version|2
minzoom|0
maxzoom|14
center|0.000000,6.000000,14
bounds|0.000000,0.000000,6.000000,6.000000
type|overlay
format|pbf
generator|tippecanoe v1.36.0
generator_options|tippecanoe -o test.mbtiles test.ndjson
json|{"vector_layers": [ { "id": "layer1", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer2", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer3", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer4", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer5", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer6", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} }, { "id": "layer7", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {} } ],"tilestats": {"layerCount": 7,"layers": [{"layer": "layer1","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer2","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer3","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer4","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer5","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer6","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []},{"layer": "layer7","count": 1,"geometry": "Point","attributeCount": 0,"attributes": []}]}}

@hfu Do you have any advice?

kata.yml イメージ

airport: 
  source: |
    curl https://somewhere/airport.geojsons
  properties: |
    f => f.properties
  minzoom: 8
  maxzoom: 14
voxel:
  source: |
    curl https://somewhere/points.geojsons
  properties: |
    f => { "name": properties.name_ja }
  minzoom: 8
  maxzoom: 14
  geometry: |
    lng = f.geometry.coordinates[0]
    lat = f.geometry.coordinates[1]
    f => {
      return {
        type: 'Polygon',
        coordinates: [
          [
            [ x, y ],
            [ x + 0.01, y ],
            [ x + 0.01, y + 0.01 ],
            [ x, y + 0.01],
            [ x, y ]
          ]
        ]
      }
    }

layer nameの指定について

filterの機能を早速試させていただいています!ありがとうございます。

複数のgeojsonファイルをフィルターするとき、ベクトルタイルのレイヤ名はどうやって指定できるでしょうか?
minzoomとmaxzoomはkata.ymlで指定できますが、layerをkata.tmlに追加してもtippecanoeのプロパティには反映されません。

もともとのgeojsonのファイル名が反映されるかなと思って実験したのですが、一つの入力ファイルなので一つのレイヤとして処理されてしまっているようです。
image

私の使い方がそもそも間違っていたらすみませんが、何かご経験があれば教えていただけると大変幸いです!

(参考)
https://speakerdeck.com/hfu/unvtwakusiyotupu-ri-ben-yu-ban?slide=26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.