@geolonia/mbgl-japanese-prefs
v0.2.2
Published
[![Build Status](https://travis-ci.org/geolonia/mbgl-japanese-prefs.svg?branch=master)](https://travis-ci.org/geolonia/mbgl-japanese-prefs) [![npm version](https://badge.fury.io/js/%40geolonia%2Fmbgl-japanese-prefs.svg)](https://badge.fury.io/js/%40geolon
Downloads
2
Keywords
Readme
@geolonia/mbgl-japanese-prefs
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