Giter VIP home page Giter VIP logo

yolp-mapbox-static-maps's Introduction

yolp-mapbox-static-maps

YOLPスタティックイメージからMapbox Static Imagesへの移行JSライブラリ

実装デモをご参照ください。

インストール

yarn add @mapbox/yolp-mapbox-static-maps
# 又は 
npm install @mapbox/yolp-mapbox-static-maps

実装

JSに導入する場合の実装。

import {convert} from 'yolp-mapbox-static-maps'

const yjApiUrl = 'https://map.yahooapis.jp/map/V1/static?appid=/<アプリケーションID>/&lat=35.658619279712&lon=139.74553000746&z=15&width=600&height=600'
const opts = {
    accountId: 'マップボックスID',
    mapboxToken: 'Mapboxトークン',
    style: 'Mapboxで作成した地図のスタイル',
}
const mapboxUrl = convert(yjApiUrl, opts)
console.log(mapboxUrl)
// https://api.mapbox.com/styles/v1/<マップボックスID>/<Mapboxで作成した地図のスタイル>/static/139.74553000746,35.658619279712,13/600x600?access_token=<Mapboxトークン>

又はHTMLに直接埋め込めれます。

<head>
  <script src="https://cdn.." integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
</head>

<body>
    <!-- 既存実装方法 -->
    <img src='yolpUrl' />

    <!-- Mapboxへ移行 -->
    <img src='convert(yolpUrl)' />
</body>

移行による比較

事例 YOLP Mapbox
地図を表示する alt alt
衛星写真を表示する alt alt
ピンを立てる alt alt
線を描く alt alt
円を描く alt alt
ポリゴンを描く alt alt

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.