Giter Club home page Giter Club logo

kushimoto-hazard-shelter-api's Introduction

Vector Tiles API

このリポジトリは、CSVGeoJSON フォーマットのデータを GitHub Actions で Mapbox Vector Tile (.mvt) フォーマットに変換し API として公開するためのテンプレートリポジトリです。 生成したタイルは、空間IDタイルデータ取得SDKや、Mapbox GL JS、 MapLibre GL JS、Geolonia の Javascript API等でご利用いただけます。

ご利用方法

  • [Use this template] ボタンをクリックして、このテンプレートを自分のリポジトリにコピーしてください。
  • GitHub Pages の設定方法 を参考に設定をして下さい。
  • example.csv を編集してコミットすると数分後に ベクトルタイルが生成されます。
  • https://<あなたのGitHubユーザー名>.github.io/<リポジトリ名>/tiles/tiles.json の URLが生成されます。(サンプル URL

空間IDタイルデータ取得SDKのご利用方法

以下の公式ドキュメントをご参考ください。
https://github.com/geolonia/spatial-id-request-sdk/blob/main/README.md

Mapbox GL JS 等のラリブラリでのご利用方法

生成した tiles.json の URL を以下のように指定することで、データソースとして地図に追加できます。

  • source-layer は、g-simplestyle-v1 と指定して下さい。
const map = new geolonia.Map({
  container: "#map",
  center: [139.73807, 35.65118],
  zoom: 13,
});

map.on("load", () => {

  map.addSource("sample-data", {
    type: "vector",
    url: "https://YOUR-GITHUB-USER.github.io/YOUR-REPOSITORY/tiles/tiles.json",
  });

  map.addLayer({
    id: "circle",
    source: "my-data",
    "source-layer": "g-simplestyle-v1",
    type: "circle",
    paint: {
      "circle-color": "#ff0000",
      "circle-opacity": 0.5,
      "circle-radius": 20
    },
    layout: {}
  });
});

上記は、Geolonia Javascript API の例になります。

GeoJSON データのご利用方法

  • 以下の build.yml の 20行目の "*.csv""*.geojson" に書き換えて push して下さい。
  • example.csv を削除し、example.geojson をアップロードして下さい。数分でタイルが生成されます。

build.yml

  with:
    file: "*.csv"
    out_dir: ./

https://github.com/geolonia/vector-tiles-api/blob/main/.github/workflows/build.yml#L20

GitHub Pages の設定方法

  • GitHub のリポジトリのメニューの中にある [Settings] をクリックしてください。
  • 移動先のページの下の方にある [GitHub Pages] のところで、以下のように設定してください。

sample

データ出典

サンプルデータは以下のデータを利用しています。

kushimoto-hazard-shelter-api's People

Contributors

naogify avatar

Watchers

 avatar

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.