@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
|
@@ -912,7 +912,7 @@ function getSpatialFiltersResolution(source, viewState) {
|
|
|
912
912
|
const tileSize = DEFAULT_TILE_SIZE;
|
|
913
913
|
const maxResolutionForZoom = (_maxH3SpatialFiltersR = (_maxH3SpatialFiltersR2 = maxH3SpatialFiltersResolutions.find(([zoom]) => zoom === currentZoomInt)) == null ? void 0 : _maxH3SpatialFiltersR2[1]) != null ? _maxH3SpatialFiltersR : Math.max(0, currentZoomInt - 3);
|
|
914
914
|
const maxSpatialFiltersResolution = maxResolutionForZoom ? Math.min(dataResolution, maxResolutionForZoom) : dataResolution;
|
|
915
|
-
const hexagonResolution =
|
|
915
|
+
const hexagonResolution = _getHexagonResolution(viewState, tileSize) + aggregationResLevelOffset;
|
|
916
916
|
return Math.min(hexagonResolution, maxSpatialFiltersResolution);
|
|
917
917
|
}
|
|
918
918
|
if (source.spatialDataType === 'quadbin') {
|
|
@@ -927,10 +927,13 @@ const maxH3SpatialFiltersResolutions = [[20, 14], [19, 13], [18, 12], [17, 11],
|
|
|
927
927
|
// stolen from https://github.com/visgl/deck.gl/blob/master/modules/carto/src/layers/h3-tileset-2d.ts
|
|
928
928
|
// Relative scale factor (0 = no biasing, 2 = a few hexagons cover view)
|
|
929
929
|
const BIAS = 2;
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
930
|
+
/**
|
|
931
|
+
* Resolution conversion function. Takes a WebMercatorViewport and returns
|
|
932
|
+
* a H3 resolution such that the screen space size of the hexagons is
|
|
933
|
+
* "similar" to the given tileSize on screen. Intended for use with deck.gl.
|
|
934
|
+
* @internal
|
|
935
|
+
*/
|
|
936
|
+
function _getHexagonResolution(viewport, tileSize) {
|
|
934
937
|
// Difference in given tile size compared to deck's internal 512px tile size,
|
|
935
938
|
// expressed as an offset to the viewport zoom.
|
|
936
939
|
const zoomOffset = Math.log2(tileSize / DEFAULT_TILE_SIZE);
|
|
@@ -1735,5 +1738,5 @@ const query = async function query(options) {
|
|
|
1735
1738
|
});
|
|
1736
1739
|
};
|
|
1737
1740
|
|
|
1738
|
-
export { ApiVersion, CartoAPIError, DEFAULT_API_BASE_URL, FilterType, SOURCE_DEFAULTS, WidgetBaseSource, WidgetQuerySource, WidgetTableSource, addFilter, boundaryQuerySource, boundaryTableSource, buildPublicMapUrl, buildStatsUrl, clearFilters, createPolygonSpatialFilter, createViewportSpatialFilter, getClient, getFilter, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, setClient, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
|
1741
|
+
export { ApiVersion, CartoAPIError, DEFAULT_API_BASE_URL, FilterType, SOURCE_DEFAULTS, WidgetBaseSource, WidgetQuerySource, WidgetTableSource, _getHexagonResolution, addFilter, boundaryQuerySource, boundaryTableSource, buildPublicMapUrl, buildStatsUrl, clearFilters, createPolygonSpatialFilter, createViewportSpatialFilter, getClient, getFilter, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, setClient, vectorQuerySource, vectorTableSource, vectorTilesetSource };
|
|
1739
1742
|
//# sourceMappingURL=api-client.modern.js.map
|