Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(prerelease): v0.4.0-alpha.x #21

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ Decodes an string into an index. Inverse of `bigIntToHex()`.
## getResolution

```javascript
function getResolution(quadbin: bigint): bigint
function getResolution(quadbin: bigint): bigint
```

Calculates the resolution of a quadbin cell.

## function cellToParent

```javascript
function cellToParent(quadbin: bigint): bigint
function cellToParent(quadbin: bigint): bigint
```

Calculates the parent cell.
Expand All @@ -63,8 +63,7 @@ Calculates the parent cell.
function cellToChildren(quadbin: bigint, resolution: bigint): bigint[]
```

Calculates the child cells at given resolution. Results returned in
row-major order starting from NW and ending at SE.
Calculates the child cells at given resolution.

## tileToCell

Expand All @@ -77,21 +76,21 @@ Converts a xyz tile into a quadbin cell.
## cellToTile

```javascript
function cellToTile(quadbin: bigint): Tile
function cellToTile(quadbin: bigint): Tile
```

Converts quadbin cell into a xyz tile.

## geometryToCells

```javascript
function geometryToCells(geometry: GeoJSONGeometry, resolution: bigint): bigint
function geometryToCells(geometry: GeoJSONGeometry, resolution: bigint): bigint
```

## cellToBoundary

```javascript
function cellToBoundary(quadbin: Quadbin): Polygon
function cellToBoundary(quadbin: Quadbin): Polygon
```

Converts a Quadbin cell identifier into a geographical boundary represented as a polygon
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quadbin",
"version": "0.2.0",
"version": "0.4.0-alpha.2",
"description": "Utility functions for working with Quadbins",
"license": "MIT",
"type": "module",
Expand All @@ -27,7 +27,7 @@
"url": "https://github.com/CartoDB/quadbin-js.git"
},
"scripts": {
"clean": "rm -rf \"dist/*\"",
"clean": "rm -rf dist/* || true",
"build": "microbundle --name quadbin --format cjs,modern,umd --no-compress",
"build:watch": "microbundle watch --name quadbin --format cjs,modern,umd --no-compress",
"lint": "prettier --check src",
Expand All @@ -40,6 +40,12 @@
"prepublish": "yarn lint && yarn test",
"prepack": "yarn clean && yarn build"
},
"files": [
"dist",
"src",
"README.md",
"LICENSE.md"
],
"browser": {
"jsdom": false
},
Expand All @@ -66,8 +72,5 @@
"@math.gl/web-mercator": "^4.1.0"
},
"packageManager": "[email protected]",
"volta": {
"node": "20.18.2",
"yarn": "4.3.1"
}
"stableVersion": "0.3.0"
}
4 changes: 2 additions & 2 deletions scripts/postversion-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ if (!valid(version)) {
throw new Error(`Invalid version, "${version}"`);
}

// Check out a branch if cutting a version from 'main'.
// Check out a branch if cutting a version from 'master'.
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
if (branch === 'main') {
if (branch === 'master') {
execSync(`git checkout -b 'release/${version}'`);
}

Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ export function cellToParent(quadbin: Quadbin): Quadbin {
}

/**
* Returns the children of a cell, in row-major order starting from NW and ending at SE.
* Returns the children of a cell.
*
* @privateRemarks Order of the child cells would, preferably, be
* row-major starting from NW and ending at SE.
*/
export function cellToChildren(quadbin: Quadbin, resolution: bigint): Quadbin[] {
if (resolution < 0 || resolution > 26 || resolution < getResolution(quadbin)) {
Expand Down