@geolonia/mbgl-japanese-prefs

0.2.2 • Public • Published

@geolonia/mbgl-japanese-prefs

Build Status npm version

Displays Japanese Prefectures on OpenMapTiles based map.

DEMO

https://geolonia.github.io/mbgl-japanese-prefs/#5/35.69/139.69

How to use

$ npm install @geolonia/mbgl-japanese-prefs --save

Then:

import 'babel-polyfill' // For ie11
import jaPrefs from '@geolonia/mbgl-japanese-prefs'

const map = new mapboxgl.Map({
  container: 'map',
  style: 'https://geolonia.github.io/tiny-tileserver/style.json',
  attributionControl: true,
  hash: true,
  localIdeographFontFamily: "sans-serif",
  interactive: true
});

new jaPrefs().addTo(map)

Options

new jaPrefs({
  id: "japanese-prefectures",
  textFiled: "{name:latin}\n{name:ja}",
  minzoom: 0,
  maxzoom: 9,
  textFont: ['Noto Sans Regular'],
  textSize: 14,
  before: "", // The ID of an existing layer to insert the new layer before.
}).addTo(map)

Internal API

To get GeoJSON, you can do as follows.

import jaPrefs from '@geolonia/mbgl-japanese-prefs'

const geojson = new jaPrefs().getGeoJSON()
console.log(geojson) // GeoJSON of Japanese prefectures

To get layer json for style.json:

import jaPrefs from '@geolonia/mbgl-japanese-prefs'

const layer = new jaPrefs().getLayer()
console.log(layer) // Layer JSON

Readme

Keywords

none

Package Sidebar

Install

npm i @geolonia/mbgl-japanese-prefs

Weekly Downloads

1

Version

0.2.2

License

MIT

Unpacked Size

597 kB

Total Files

19

Last publish

Collaborators

  • miya0001
  • naogify
  • sleepy_keita