@deck.gl/carto 9.0.0 → 9.0.2

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.
@@ -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: any): number;
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,KAAA,GAAG,MA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Relative scale factor (0 = no biasing, 2 = a few hexagons cover view)
45
45
  const BIAS = 2;
46
- export function getHexagonResolution(viewport) {
47
- const hexagonScaleFactor = (2 / 3) * viewport.zoom;
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
- let z = getHexagonResolution(viewport);
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.0-beta.10" !== 'undefined' ? "9.0.0-beta.10" : 'latest';
4
+ const VERSION = typeof "9.0.1" !== 'undefined' ? "9.0.1" : '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.0-beta.10" !== 'undefined' ? "9.0.0-beta.10" : 'latest';
5
+ const VERSION = typeof "9.0.1" !== 'undefined' ? "9.0.1" : '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.0-beta.10" !== 'undefined' ? "9.0.0-beta.10" : 'latest';
5
+ const VERSION = typeof "9.0.1" !== 'undefined' ? "9.0.1" : '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,CA8CtD"}
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
- return await requestWithParameters({
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,