@deck.gl/carto 9.0.1 → 9.0.3
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/dist/api/request-with-parameters.d.ts +1 -2
- package/dist/api/request-with-parameters.d.ts.map +1 -1
- package/dist/api/request-with-parameters.js +1 -4
- package/dist/cartoRasterTile-worker.js +1 -1
- package/dist/cartoSpatialTile-worker.js +1 -1
- package/dist/cartoVectorTile-worker.js +1 -1
- package/dist/dist.dev.js +12 -11
- package/dist/index.cjs +16 -14
- package/dist/index.cjs.map +2 -2
- package/dist/layers/h3-tile-layer.js +2 -2
- package/dist/layers/h3-tileset-2d.d.ts +4 -1
- package/dist/layers/h3-tileset-2d.d.ts.map +1 -1
- package/dist/layers/h3-tileset-2d.js +7 -3
- package/dist/layers/schema/carto-raster-tile-loader.js +1 -1
- package/dist/layers/schema/carto-spatial-tile-loader.js +1 -1
- package/dist/layers/schema/carto-vector-tile-loader.js +1 -1
- package/dist/sources/base-source.d.ts.map +1 -1
- package/dist/sources/base-source.js +5 -2
- package/dist.min.js +8 -8
- package/package.json +3 -3
- package/src/api/request-with-parameters.ts +0 -5
- package/src/layers/h3-tile-layer.ts +2 -2
- package/src/layers/h3-tileset-2d.ts +10 -3
- package/src/sources/base-source.ts +5 -2
|
@@ -41,10 +41,10 @@ export default class H3TileLayer extends CompositeLayer {
|
|
|
41
41
|
// Convert Mercator zooms provided in props into H3 res levels
|
|
42
42
|
// and clip into valid range provided from the tilejson
|
|
43
43
|
if (this.props.minZoom) {
|
|
44
|
-
minresolution = Math.max(minresolution, getHexagonResolution({ zoom: this.props.minZoom, latitude: 0 }));
|
|
44
|
+
minresolution = Math.max(minresolution, getHexagonResolution({ zoom: this.props.minZoom, latitude: 0 }, this.props.tileSize));
|
|
45
45
|
}
|
|
46
46
|
if (this.props.maxZoom) {
|
|
47
|
-
maxresolution = Math.min(maxresolution, getHexagonResolution({ zoom: this.props.maxZoom, latitude: 0 }));
|
|
47
|
+
maxresolution = Math.min(maxresolution, getHexagonResolution({ zoom: this.props.maxZoom, latitude: 0 }, this.props.tileSize));
|
|
48
48
|
}
|
|
49
49
|
// The naming is unfortunate, but minZoom & maxZoom in the context
|
|
50
50
|
// of a Tileset2D refer to the resolution levels, not the Mercator zooms
|
|
@@ -2,7 +2,10 @@ import { _Tileset2D as Tileset2D, GeoBoundingBox } from '@deck.gl/geo-layers';
|
|
|
2
2
|
export type H3TileIndex = {
|
|
3
3
|
i: string;
|
|
4
4
|
};
|
|
5
|
-
export declare function getHexagonResolution(viewport:
|
|
5
|
+
export declare function getHexagonResolution(viewport: {
|
|
6
|
+
zoom: number;
|
|
7
|
+
latitude: number;
|
|
8
|
+
}, tileSize: number): number;
|
|
6
9
|
export default class H3Tileset2D extends Tileset2D {
|
|
7
10
|
/**
|
|
8
11
|
* Returns all tile indices in the current viewport. If the current zoom level is smaller
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h3-tileset-2d.d.ts","sourceRoot":"","sources":["../../src/layers/h3-tileset-2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,SAAS,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAU5E,MAAM,MAAM,WAAW,GAAG;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;AA0DtC,wBAAgB,oBAAoB,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"h3-tileset-2d.d.ts","sourceRoot":"","sources":["../../src/layers/h3-tileset-2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,SAAS,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAU5E,MAAM,MAAM,WAAW,GAAG;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;AA0DtC,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,EAC1C,QAAQ,EAAE,MAAM,GACf,MAAM,CASR;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS;IAChD;;;;OAIG;IAEH,cAAc,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC;;;;KAAA,GAAG,WAAW,EAAE;IA0B3D,SAAS,CAAC,EAAC,CAAC,EAAC,EAAE,WAAW,GAAG,MAAM;IAKnC,eAAe,CAAC,EAAC,CAAC,EAAC,EAAE,WAAW;;;IAKhC,WAAW,CAAC,EAAC,CAAC,EAAC,EAAE,WAAW,GAAG,MAAM;IAKrC,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;CAKhD"}
|
|
@@ -43,8 +43,11 @@ function tileToBoundingBox(index) {
|
|
|
43
43
|
// similar
|
|
44
44
|
// Relative scale factor (0 = no biasing, 2 = a few hexagons cover view)
|
|
45
45
|
const BIAS = 2;
|
|
46
|
-
export function getHexagonResolution(viewport) {
|
|
47
|
-
|
|
46
|
+
export function getHexagonResolution(viewport, tileSize) {
|
|
47
|
+
// Difference in given tile size compared to deck's internal 512px tile size,
|
|
48
|
+
// expressed as an offset to the viewport zoom.
|
|
49
|
+
const zoomOffset = Math.log2(tileSize / 512);
|
|
50
|
+
const hexagonScaleFactor = (2 / 3) * (viewport.zoom - zoomOffset);
|
|
48
51
|
const latitudeScaleFactor = Math.log(1 / Math.cos((Math.PI * viewport.latitude) / 180));
|
|
49
52
|
// Clip and bias
|
|
50
53
|
return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
|
|
@@ -60,7 +63,8 @@ export default class H3Tileset2D extends Tileset2D {
|
|
|
60
63
|
if (viewport.latitude === undefined)
|
|
61
64
|
return [];
|
|
62
65
|
const [east, south, west, north] = viewport.getBounds();
|
|
63
|
-
|
|
66
|
+
const { tileSize } = this.opts;
|
|
67
|
+
let z = getHexagonResolution(viewport, tileSize);
|
|
64
68
|
let indices;
|
|
65
69
|
if (typeof minZoom === 'number' && Number.isFinite(minZoom) && z < minZoom) {
|
|
66
70
|
// TODO support `extent` prop
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TileReader } from "./carto-raster-tile.js";
|
|
2
2
|
import { parsePbf } from "./tile-loader-utils.js";
|
|
3
3
|
import { getWorkerUrl } from "../../utils.js";
|
|
4
|
-
const VERSION = typeof "9.0.
|
|
4
|
+
const VERSION = typeof "9.0.2" !== 'undefined' ? "9.0.2" : 'latest';
|
|
5
5
|
const id = 'cartoRasterTile';
|
|
6
6
|
const DEFAULT_OPTIONS = {
|
|
7
7
|
cartoRasterTile: {
|
|
@@ -2,7 +2,7 @@ import { TileReader } from "./carto-spatial-tile.js";
|
|
|
2
2
|
import { parsePbf } from "./tile-loader-utils.js";
|
|
3
3
|
import { getWorkerUrl } from "../../utils.js";
|
|
4
4
|
import { binaryToSpatialjson } from "./spatialjson-utils.js";
|
|
5
|
-
const VERSION = typeof "9.0.
|
|
5
|
+
const VERSION = typeof "9.0.2" !== 'undefined' ? "9.0.2" : 'latest';
|
|
6
6
|
const id = 'cartoSpatialTile';
|
|
7
7
|
const DEFAULT_OPTIONS = {
|
|
8
8
|
cartoSpatialTile: {
|
|
@@ -2,7 +2,7 @@ import earcut from 'earcut';
|
|
|
2
2
|
import { TileReader } from "./carto-tile.js";
|
|
3
3
|
import { parsePbf } from "./tile-loader-utils.js";
|
|
4
4
|
import { getWorkerUrl } from "../../utils.js";
|
|
5
|
-
const VERSION = typeof "9.0.
|
|
5
|
+
const VERSION = typeof "9.0.2" !== 'undefined' ? "9.0.2" : 'latest';
|
|
6
6
|
const id = 'cartoVectorTile';
|
|
7
7
|
const DEFAULT_OPTIONS = {
|
|
8
8
|
cartoVectorTile: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-source.d.ts","sourceRoot":"","sources":["../../src/sources/base-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAkB,OAAO,EAAC,wBAAqB;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EAErB,cAAc,EACf,mBAAgB;AAEjB,eAAO,MAAM,eAAe,EAAE,qBAK7B,CAAC;AAEF,wBAAsB,UAAU,CAAC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3E,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,EAC/D,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"base-source.d.ts","sourceRoot":"","sources":["../../src/sources/base-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAkB,OAAO,EAAC,wBAAqB;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EAErB,cAAc,EACf,mBAAgB;AAEjB,eAAO,MAAM,eAAe,EAAE,qBAK7B,CAAC;AAEF,wBAAsB,UAAU,CAAC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3E,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,EAC/D,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC,CAiDtD"}
|
|
@@ -38,12 +38,15 @@ export async function baseSource(endpoint, options, urlParameters) {
|
|
|
38
38
|
}
|
|
39
39
|
errorContext.requestType = 'Map data';
|
|
40
40
|
if (format === 'tilejson') {
|
|
41
|
-
|
|
42
|
-
accessToken,
|
|
41
|
+
const json = await requestWithParameters({
|
|
43
42
|
baseUrl: dataUrl,
|
|
44
43
|
headers,
|
|
45
44
|
errorContext
|
|
46
45
|
});
|
|
46
|
+
if (accessToken) {
|
|
47
|
+
json.accessToken = accessToken;
|
|
48
|
+
}
|
|
49
|
+
return json;
|
|
47
50
|
}
|
|
48
51
|
return await requestWithParameters({
|
|
49
52
|
baseUrl: dataUrl,
|