Skip to content

Commit

Permalink
Switch to using quadbin library (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixpalmer authored Sep 30, 2022
1 parent 54a0803 commit 6c00f1e
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 51 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Not released

- Switch to using quadbin library, requiring deck.gl ^8.9.0-alpha.3 [#467](https://github.com/CartoDB/carto-react/pull/467)

## 1.4

### 1.4.1 (2002-09-20)
Expand Down
2 changes: 2 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ module.exports = {
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],
transformIgnorePatterns: ['node_modules/(?!(@mapbox/tiny-sdf|mapbox-gl)/)'],


// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "1.4.1"
"version": "1.5.0-alpha.0"
}
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
"packages/*"
],
"devDependencies": {
"@deck.gl/aggregation-layers": "^8.8.0",
"@deck.gl/carto": "^8.8.0",
"@deck.gl/core": "^8.8.0",
"@deck.gl/extensions": "^8.8.0",
"@deck.gl/geo-layers": "^8.8.0",
"@deck.gl/google-maps": "^8.8.0",
"@deck.gl/layers": "^8.8.0",
"@deck.gl/mesh-layers": "^8.8.0",
"@mapbox/tile-cover": "^3.0.2",
"@deck.gl/aggregation-layers": "^8.9.0-alpha.3",
"@deck.gl/carto": "^8.9.0-alpha.3",
"@deck.gl/core": "^8.9.0-alpha.3",
"@deck.gl/extensions": "^8.9.0-alpha.3",
"@deck.gl/geo-layers": "^8.9.0-alpha.3",
"@deck.gl/google-maps": "^8.9.0-alpha.3",
"@deck.gl/layers": "^8.9.0-alpha.3",
"@deck.gl/mesh-layers": "^8.9.0-alpha.3",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
Expand All @@ -38,6 +37,7 @@
"lint-staged": "^10.5.3",
"nyc": "^15.1.0",
"patch-package": "6.4.7",
"quadbin": "^0.1.4",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-redux": "^7.2.2",
Expand Down
14 changes: 7 additions & 7 deletions packages/react-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-api",
"version": "1.4.1",
"version": "1.5.0-alpha.0",
"description": "CARTO for React - Api",
"author": "CARTO Dev Team",
"keywords": [
Expand Down Expand Up @@ -64,12 +64,12 @@
"@babel/runtime": "^7.13.9"
},
"peerDependencies": {
"@carto/react-core": "^1.4.0-alpha.5",
"@carto/react-redux": "^1.4.0-alpha.5",
"@carto/react-workers": "^1.4.0-alpha.5",
"@deck.gl/carto": "^8.8.0",
"@deck.gl/core": "^8.8.0",
"@deck.gl/extensions": "^8.8.0",
"@carto/react-core": "^1.4.0",
"@carto/react-redux": "^1.4.0",
"@carto/react-workers": "^1.4.0",
"@deck.gl/carto": "^8.9.0-alpha.3",
"@deck.gl/core": "^8.9.0-alpha.3",
"@deck.gl/extensions": "^8.9.0-alpha.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-redux": "^7.2.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-auth",
"version": "1.4.1",
"version": "1.5.0-alpha.0",
"description": "CARTO for React - Auth",
"author": "CARTO Dev Team",
"keywords": [
Expand Down Expand Up @@ -64,7 +64,7 @@
"@babel/runtime": "^7.13.9"
},
"peerDependencies": {
"@carto/react-core": "^1.4.0-alpha.5",
"@carto/react-core": "^1.4.0",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/react-basemaps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-basemaps",
"version": "1.4.1",
"version": "1.5.0-alpha.0",
"description": "CARTO for React - Basemaps",
"keywords": [
"carto",
Expand Down Expand Up @@ -64,8 +64,8 @@
"@babel/runtime": "^7.13.9"
},
"peerDependencies": {
"@carto/react-core": "^1.4.0-alpha.5",
"@deck.gl/google-maps": "^8.8.0",
"@carto/react-core": "^1.4.0",
"@deck.gl/google-maps": "^8.9.0-alpha.3",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}
Expand Down
8 changes: 4 additions & 4 deletions packages/react-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-core",
"version": "1.4.1",
"version": "1.5.0-alpha.0",
"description": "CARTO for React - Core",
"author": "CARTO Dev Team",
"keywords": [
Expand Down Expand Up @@ -64,13 +64,13 @@
"@babel/runtime": "^7.13.9"
},
"peerDependencies": {
"@deck.gl/carto": "^8.8.0",
"@mapbox/tile-cover": "^3.0.2",
"@deck.gl/carto": "^8.9.0-alpha.3",
"@turf/bbox-clip": "^6.3.0",
"@turf/bbox-polygon": "^6.3.0",
"@turf/boolean-intersects": "^6.3.0",
"@turf/boolean-within": "^6.3.0",
"@turf/intersect": "^6.3.0",
"h3-js": "^3.7.2"
"h3-js": "^3.7.2",
"quadbin": "^0.1.4"
}
}
11 changes: 4 additions & 7 deletions packages/react-core/src/filters/tileFeaturesSpatialIndex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { _quadbinZoom, _tileToQuadbin } from '@deck.gl/carto';
import { tiles } from '@mapbox/tile-cover';
import { getResolution as quadbinGetResolution, geometryToCells } from 'quadbin';

// h3-js has a known problem that does not allow us to use it in a web-worker. To solve
// it we're overwriting the node_module package after install it (check postinstall script in the package.json and the patches/h3-js+3.7.2.patch file)
// To know more about the h3-js issue check https://github.com/uber/h3-js/issues/117
Expand Down Expand Up @@ -57,7 +57,7 @@ function getResolution(tiles, spatialIndex) {
}

if (spatialIndex === SpatialIndex.QUADBIN) {
return Number(_quadbinZoom(data[0].id));
return Number(quadbinGetResolution(data[0].id));
}

if (spatialIndex === SpatialIndex.H3) {
Expand All @@ -70,10 +70,7 @@ const bboxEast = [0, -90, 180, 90];

function getCellsCoverGeometry(geometry, spatialIndex, resolution) {
if (spatialIndex === SpatialIndex.QUADBIN) {
return tiles(geometry, {
min_zoom: resolution,
max_zoom: resolution
}).map(([x, y, z]) => _tileToQuadbin({ x, y, z }));
return geometryToCells(geometry, resolution);
}

if (spatialIndex === SpatialIndex.H3) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const webpackBaseConfig = require('../../webpack.base');
const webpackConfig = {
...webpackBaseConfig,
// Be careful what you add as external because it can significantly affect the size of the worker package.
externals: [/^@turf\/.+$/, '@mapbox/tile-cover', 'h3-js'],
externals: [/^@turf\/.+$/, 'h3-js', 'quadbin'],
output: {
path: path.resolve(__dirname, './dist'),
filename: 'index.js',
Expand Down
10 changes: 5 additions & 5 deletions packages/react-redux/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-redux",
"version": "1.4.1",
"version": "1.5.0-alpha.0",
"description": "CARTO for React - Redux",
"author": "CARTO Dev Team",
"keywords": [
Expand Down Expand Up @@ -63,10 +63,10 @@
"@babel/runtime": "^7.13.9"
},
"peerDependencies": {
"@carto/react-core": "^1.4.0-alpha.5",
"@carto/react-workers": "^1.4.0-alpha.5",
"@deck.gl/carto": "^8.8.0",
"@deck.gl/core": "^8.8.0",
"@carto/react-core": "^1.4.0",
"@carto/react-workers": "^1.4.0",
"@deck.gl/carto": "^8.9.0-alpha.3",
"@deck.gl/core": "^8.9.0-alpha.3",
"@reduxjs/toolkit": "^1.5.0"
}
}
4 changes: 2 additions & 2 deletions packages/react-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-ui",
"version": "1.4.1",
"version": "1.5.0-alpha.0",
"description": "CARTO for React - UI",
"author": "CARTO Dev Team",
"keywords": [
Expand Down Expand Up @@ -75,7 +75,7 @@
"@babel/runtime": "^7.13.9"
},
"peerDependencies": {
"@carto/react-core": "^1.4.0-alpha.5",
"@carto/react-core": "^1.4.0",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
Expand Down
16 changes: 8 additions & 8 deletions packages/react-widgets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-widgets",
"version": "1.4.1",
"version": "1.5.0-alpha.0",
"description": "CARTO for React - Widgets",
"author": "CARTO Dev Team",
"keywords": [
Expand Down Expand Up @@ -65,13 +65,13 @@
"@babel/runtime": "^7.13.9"
},
"peerDependencies": {
"@carto/react-api": "^1.4.0-alpha.5",
"@carto/react-core": "^1.4.0-alpha.5",
"@carto/react-redux": "^1.4.0-alpha.5",
"@carto/react-ui": "^1.4.0-alpha.5",
"@carto/react-workers": "^1.4.0-alpha.5",
"@deck.gl/core": "^8.8.0",
"@deck.gl/layers": "^8.8.0",
"@carto/react-api": "^1.4.0",
"@carto/react-core": "^1.4.0",
"@carto/react-redux": "^1.4.0",
"@carto/react-ui": "^1.4.0",
"@carto/react-workers": "^1.4.0",
"@deck.gl/core": "^8.9.0-alpha.3",
"@deck.gl/layers": "^8.9.0-alpha.3",
"@material-ui/core": "^4.11.3",
"@nebula.gl/edit-modes": "^1.0.3",
"@nebula.gl/layers": "^1.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-workers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@carto/react-workers",
"version": "1.4.1",
"version": "1.5.0-alpha.0",
"description": "CARTO for React - Workers",
"author": "CARTO Dev Team",
"keywords": [
Expand Down Expand Up @@ -62,7 +62,7 @@
},
"dependencies": {
"@babel/runtime": "^7.13.9",
"@carto/react-core": "^1.4.1",
"@carto/react-core": "^1.5.0-alpha.0",
"@turf/bbox-polygon": "^6.3.0",
"@turf/boolean-intersects": "^6.3.0",
"@turf/boolean-within": "^6.3.0",
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14869,6 +14869,13 @@ qs@~6.5.2:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==

quadbin@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/quadbin/-/quadbin-0.1.4.tgz#4f3dae4316105ae85cfc0473c450558f9c21f7b5"
integrity sha512-CU4wivjITfW/eewXOWjFtpZbtkRN49rCW+VvOTbd4lrj2MzLA0GGY2iWaawgBkoQQLVb7UCKRtm1ojN1Bej2Ug==
dependencies:
"@mapbox/tile-cover" "^3.0.2"

query-string@^6.13.8:
version "6.14.1"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.14.1.tgz#7ac2dca46da7f309449ba0f86b1fd28255b0c86a"
Expand Down

0 comments on commit 6c00f1e

Please sign in to comment.