s2-cell-draw

1.1.4 • Public • Published

s2-cell-draw

Build Status

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);

Package Sidebar

Install

npm i s2-cell-draw

Weekly Downloads

19

Version

1.1.4

License

ISC

Unpacked Size

9.1 kB

Total Files

5

Last publish

Collaborators

  • senmao