@carto/api-client 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/api-client.cjs +9 -5
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +9 -6
- package/build/api-client.modern.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/spatial-index.d.ts +7 -1
- package/package.json +9 -5
- package/src/index.ts +2 -0
- package/src/spatial-index.ts +8 -5
package/CHANGELOG.md
CHANGED
package/build/api-client.cjs
CHANGED
|
@@ -975,7 +975,7 @@ function getSpatialFiltersResolution(source, viewState) {
|
|
|
975
975
|
return zoom === currentZoomInt;
|
|
976
976
|
})?.[1] ?? Math.max(0, currentZoomInt - 3);
|
|
977
977
|
const maxSpatialFiltersResolution = maxResolutionForZoom ? Math.min(dataResolution, maxResolutionForZoom) : dataResolution;
|
|
978
|
-
const hexagonResolution =
|
|
978
|
+
const hexagonResolution = _getHexagonResolution(viewState, tileSize) + aggregationResLevelOffset;
|
|
979
979
|
return Math.min(hexagonResolution, maxSpatialFiltersResolution);
|
|
980
980
|
}
|
|
981
981
|
if (source.spatialDataType === 'quadbin') {
|
|
@@ -990,10 +990,13 @@ const maxH3SpatialFiltersResolutions = [[20, 14], [19, 13], [18, 12], [17, 11],
|
|
|
990
990
|
// stolen from https://github.com/visgl/deck.gl/blob/master/modules/carto/src/layers/h3-tileset-2d.ts
|
|
991
991
|
// Relative scale factor (0 = no biasing, 2 = a few hexagons cover view)
|
|
992
992
|
const BIAS = 2;
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
993
|
+
/**
|
|
994
|
+
* Resolution conversion function. Takes a WebMercatorViewport and returns
|
|
995
|
+
* a H3 resolution such that the screen space size of the hexagons is
|
|
996
|
+
* "similar" to the given tileSize on screen. Intended for use with deck.gl.
|
|
997
|
+
* @internal
|
|
998
|
+
*/
|
|
999
|
+
function _getHexagonResolution(viewport, tileSize) {
|
|
997
1000
|
// Difference in given tile size compared to deck's internal 512px tile size,
|
|
998
1001
|
// expressed as an offset to the viewport zoom.
|
|
999
1002
|
const zoomOffset = Math.log2(tileSize / DEFAULT_TILE_SIZE);
|
|
@@ -1938,6 +1941,7 @@ exports.SOURCE_DEFAULTS = SOURCE_DEFAULTS;
|
|
|
1938
1941
|
exports.WidgetBaseSource = WidgetBaseSource;
|
|
1939
1942
|
exports.WidgetQuerySource = WidgetQuerySource;
|
|
1940
1943
|
exports.WidgetTableSource = WidgetTableSource;
|
|
1944
|
+
exports._getHexagonResolution = _getHexagonResolution;
|
|
1941
1945
|
exports.addFilter = addFilter;
|
|
1942
1946
|
exports.boundaryQuerySource = boundaryQuerySource;
|
|
1943
1947
|
exports.boundaryTableSource = boundaryTableSource;
|