s2-cell-draw
v1.1.4
Published
A library for Google s2 cell drawing
Downloads
186
Maintainers
Readme
s2-cell-draw
A library for Google s2 cell draw
Install
npm i s2-cell-draw
Usage
- get s2-cell path from s2Key
const { deboxByKey } = require('s2-cell-draw');
const s2CellPath = deboxByKey('1/2231210320031100');
console.log(s2CellPath);
- get s2-cell key list that covers the screen
const { createPolygonListFromBounds } = require('s2-cell-draw');
/**
* Point:[Lng:number,Lat:number];
* bounds:[southwest:Point,northeast:Point]
*/
const s2KeyList = getPointListFromBounds({
bounds: [[121.457655, 31.22533], [121.487632, 31.238082]],
level: 16
});
console.log(s2KeyList);
- get s2-cell list that covers the screen
const { createPolygonListFromBounds } = require('s2-cell-draw');
/**
* Point:[Lng:number,Lat:number];
* bounds:[southwest:Point,northeast:Point]
*/
const polygonList = createPolygonListFromBounds({
bounds: [[121.457655, 31.22533], [121.487632, 31.238082]],
level: 16
});
console.log(polygonList);