@tilecloud/js
JS API for Tilecloud service.
features
- webGL vector map rendering
- simple configuration
- map lazy rendering
usage
zero config
Specify .tilecloud
class for target elements. If you want to call the JS-API from external origin, please specify ?tilecloud=true
query.
<!DOCTYPE html>
<html>
<body>
<div
class="tilecloud"
data-style="osm-bright" // 'osm-bright' is default
data-lat="35.681"
data-lng="139.767"
data-zoom="12"
data-hash="false"
></div>
<script src="path/to/tilecloud.js?tilecloud=true&key=api-key"></script>
</body>
</html>
Use as a module
$ yarn add @tilecloud/js # or npm install @tilecloud/js
import { preRender } from '@tilecloud/js'
const element = getElementById('map')
const style = 'https://tilecloud.io/path/to/style.json' // URL or Style object
preRender(element, style)
development
$ git clone git@github.com:tilecloud/tilecloud.js.git
$ cd tilecloud.js
$ yarn # or npm install
Run demo locally
$ npm start
build library
$ npm run build
# see ./lib
build tilecloud scripts to distribute from tilecloud endpoint
$ npm run build:tilecloud
# see ./dist
deploy demo site to GitHub pages
$ npm run deploy
publish package
$ npm version patch
$ git push origin v0.1.2 # specify new version to publish