Skip to content
A City Selector Control for Mapbox GL JS
Branch: master
Clone or download
Latest commit 6533e46 Apr 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
src update package.json Apr 14, 2019
.gitignore update readme Apr 13, 2019
LICENSE
README.md udpate readme Apr 18, 2019
package.json
style.css update package.json Apr 14, 2019

README.md

City Selector Control

npm npm

A City Selector Control for mapbox-gl

Installation

npm i city-selector-control

Usage

new CitySelectorControl(options: Object)

Options

# Name Type Description Default
1 theme String Theme, optional 'light' or 'dark'. 'light'
2 placeholder String The initialized text. '请选择'
2 hot Array The code for hot cities. ['440100', '440300', '330100', '510100']
2 zoom Number The desired zoom level. 10

Example

import CitySelectorControl from 'city-selector-control'
import 'city-selector-control/style.css'
// default options
map.addControl(new CitySelectorControl(), 'top-right')

// custom options
const citySelectorOptions = {
  theme: 'dark',
  placeholder: '全国',
  hot: ['110000', '340500'],
  zoom: 12
};
map.addControl(new CitySelectorControl(citySelectorOptions), 'top-right');

Screenshots

theme default

You can’t perform that action at this time.