@carto/api-client 0.4.3 → 0.4.5-alpha.0
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/query.d.ts +1 -1
- package/build/api-client.cjs +239 -53
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.modern.js +211 -50
- package/build/api-client.modern.js.map +1 -1
- package/build/models/model.d.ts +7 -1
- package/build/sources/types.d.ts +36 -41
- package/build/spatial-index.d.ts +8 -0
- package/build/utils.d.ts +1 -1
- package/build/widget-sources/types.d.ts +9 -1
- package/build/widget-sources/widget-base-source.d.ts +3 -3
- package/package.json +30 -35
- package/src/api/query.ts +1 -2
- package/src/models/model.ts +47 -24
- package/src/sources/boundary-query-source.ts +1 -0
- package/src/sources/boundary-table-source.ts +1 -0
- package/src/sources/h3-query-source.ts +12 -2
- package/src/sources/h3-table-source.ts +11 -2
- package/src/sources/quadbin-query-source.ts +11 -2
- package/src/sources/quadbin-table-source.ts +10 -2
- package/src/sources/types.ts +41 -45
- package/src/sources/vector-query-source.ts +11 -2
- package/src/sources/vector-table-source.ts +11 -2
- package/src/spatial-index.ts +111 -0
- package/src/utils.ts +9 -6
- package/src/widget-sources/types.ts +10 -1
- package/src/widget-sources/widget-base-source.ts +183 -23
|
@@ -686,6 +686,8 @@ async function baseSource(endpoint, options, urlParameters) {
|
|
|
686
686
|
}
|
|
687
687
|
|
|
688
688
|
// deck.gl
|
|
689
|
+
// SPDX-License-Identifier: MIT
|
|
690
|
+
// Copyright (c) vis.gl contributors
|
|
689
691
|
const boundaryQuerySource = async function boundaryQuerySource(options) {
|
|
690
692
|
const {
|
|
691
693
|
columns,
|
|
@@ -711,6 +713,8 @@ const boundaryQuerySource = async function boundaryQuerySource(options) {
|
|
|
711
713
|
};
|
|
712
714
|
|
|
713
715
|
// deck.gl
|
|
716
|
+
// SPDX-License-Identifier: MIT
|
|
717
|
+
// Copyright (c) vis.gl contributors
|
|
714
718
|
const boundaryTableSource = async function boundaryTableSource(options) {
|
|
715
719
|
const {
|
|
716
720
|
filters,
|
|
@@ -831,41 +835,43 @@ function executeModel(props) {
|
|
|
831
835
|
data,
|
|
832
836
|
filters,
|
|
833
837
|
filtersLogicalOperator = 'and',
|
|
834
|
-
|
|
838
|
+
spatialDataType = 'geo',
|
|
839
|
+
spatialFiltersMode = 'intersects',
|
|
840
|
+
spatialFiltersResolution = 0
|
|
835
841
|
} = source;
|
|
836
|
-
const queryParameters = source.queryParameters ? JSON.stringify(source.queryParameters) : '';
|
|
837
842
|
const queryParams = {
|
|
838
843
|
type,
|
|
839
844
|
client: clientId,
|
|
840
845
|
source: data,
|
|
841
|
-
params
|
|
842
|
-
queryParameters,
|
|
843
|
-
filters
|
|
846
|
+
params,
|
|
847
|
+
queryParameters: source.queryParameters || '',
|
|
848
|
+
filters,
|
|
844
849
|
filtersLogicalOperator
|
|
845
850
|
};
|
|
851
|
+
const spatialDataColumn = source.spatialDataColumn || DEFAULT_GEO_COLUMN;
|
|
846
852
|
// Picking Model API requires 'spatialDataColumn'.
|
|
847
853
|
if (model === 'pick') {
|
|
848
|
-
queryParams.spatialDataColumn =
|
|
854
|
+
queryParams.spatialDataColumn = spatialDataColumn;
|
|
849
855
|
}
|
|
850
|
-
// API supports multiple filters, we apply it only to
|
|
856
|
+
// API supports multiple filters, we apply it only to spatialDataColumn
|
|
851
857
|
const spatialFilters = source.spatialFilter ? {
|
|
852
|
-
[
|
|
858
|
+
[spatialDataColumn]: source.spatialFilter
|
|
853
859
|
} : undefined;
|
|
854
860
|
if (spatialFilters) {
|
|
855
|
-
queryParams.spatialFilters =
|
|
861
|
+
queryParams.spatialFilters = spatialFilters;
|
|
862
|
+
queryParams.spatialDataColumn = spatialDataColumn;
|
|
863
|
+
queryParams.spatialDataType = spatialDataType;
|
|
864
|
+
}
|
|
865
|
+
if (spatialDataType !== 'geo') {
|
|
866
|
+
if (spatialFiltersResolution > 0) {
|
|
867
|
+
queryParams.spatialFiltersResolution = spatialFiltersResolution;
|
|
868
|
+
}
|
|
869
|
+
queryParams.spatialFiltersMode = spatialFiltersMode;
|
|
856
870
|
}
|
|
857
|
-
const urlWithSearchParams = url + '?' +
|
|
871
|
+
const urlWithSearchParams = url + '?' + objectToURLSearchParams(queryParams).toString();
|
|
858
872
|
const isGet = urlWithSearchParams.length <= REQUEST_GET_MAX_URL_LENGTH;
|
|
859
873
|
if (isGet) {
|
|
860
874
|
url = urlWithSearchParams;
|
|
861
|
-
} else {
|
|
862
|
-
// undo the JSON.stringify, @TODO find a better pattern
|
|
863
|
-
queryParams.params = params;
|
|
864
|
-
queryParams.filters = filters;
|
|
865
|
-
queryParams.queryParameters = source.queryParameters;
|
|
866
|
-
if (spatialFilters) {
|
|
867
|
-
queryParams.spatialFilters = spatialFilters;
|
|
868
|
-
}
|
|
869
875
|
}
|
|
870
876
|
return makeCall({
|
|
871
877
|
url,
|
|
@@ -877,15 +883,71 @@ function executeModel(props) {
|
|
|
877
883
|
})
|
|
878
884
|
});
|
|
879
885
|
}
|
|
886
|
+
function objectToURLSearchParams(object) {
|
|
887
|
+
const params = new URLSearchParams();
|
|
888
|
+
for (const key in object) {
|
|
889
|
+
if (isPureObject(object[key])) {
|
|
890
|
+
params.append(key, JSON.stringify(object[key]));
|
|
891
|
+
} else if (Array.isArray(object[key])) {
|
|
892
|
+
params.append(key, JSON.stringify(object[key]));
|
|
893
|
+
} else if (object[key] === null) {
|
|
894
|
+
params.append(key, 'null');
|
|
895
|
+
} else if (object[key] !== undefined) {
|
|
896
|
+
params.append(key, String(object[key]));
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
return params;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
const DEFAULT_TILE_SIZE = 512;
|
|
903
|
+
const QUADBIN_ZOOM_MAX_OFFSET = 4;
|
|
904
|
+
function getSpatialFiltersResolution(source, viewState) {
|
|
905
|
+
var _source$dataResolutio, _source$aggregationRe;
|
|
906
|
+
const dataResolution = (_source$dataResolutio = source.dataResolution) != null ? _source$dataResolutio : Number.MAX_VALUE;
|
|
907
|
+
const aggregationResLevel = (_source$aggregationRe = source.aggregationResLevel) != null ? _source$aggregationRe : source.spatialDataType === 'h3' ? DEFAULT_AGGREGATION_RES_LEVEL_H3 : DEFAULT_AGGREGATION_RES_LEVEL_QUADBIN;
|
|
908
|
+
const aggregationResLevelOffset = Math.max(0, Math.floor(aggregationResLevel));
|
|
909
|
+
const currentZoomInt = Math.ceil(viewState.zoom);
|
|
910
|
+
if (source.spatialDataType === 'h3') {
|
|
911
|
+
var _maxH3SpatialFiltersR, _maxH3SpatialFiltersR2;
|
|
912
|
+
const tileSize = DEFAULT_TILE_SIZE;
|
|
913
|
+
const maxResolutionForZoom = (_maxH3SpatialFiltersR = (_maxH3SpatialFiltersR2 = maxH3SpatialFiltersResolutions.find(([zoom]) => zoom === currentZoomInt)) == null ? void 0 : _maxH3SpatialFiltersR2[1]) != null ? _maxH3SpatialFiltersR : Math.max(0, currentZoomInt - 3);
|
|
914
|
+
const maxSpatialFiltersResolution = maxResolutionForZoom ? Math.min(dataResolution, maxResolutionForZoom) : dataResolution;
|
|
915
|
+
const hexagonResolution = getHexagonResolution(viewState, tileSize) + aggregationResLevelOffset;
|
|
916
|
+
return Math.min(hexagonResolution, maxSpatialFiltersResolution);
|
|
917
|
+
}
|
|
918
|
+
if (source.spatialDataType === 'quadbin') {
|
|
919
|
+
const maxResolutionForZoom = currentZoomInt + QUADBIN_ZOOM_MAX_OFFSET;
|
|
920
|
+
const maxSpatialFiltersResolution = Math.min(dataResolution, maxResolutionForZoom);
|
|
921
|
+
const quadsResolution = Math.floor(viewState.zoom) + aggregationResLevelOffset;
|
|
922
|
+
return Math.min(quadsResolution, maxSpatialFiltersResolution);
|
|
923
|
+
}
|
|
924
|
+
return undefined;
|
|
925
|
+
}
|
|
926
|
+
const maxH3SpatialFiltersResolutions = [[20, 14], [19, 13], [18, 12], [17, 11], [16, 10], [15, 9], [14, 8], [13, 7], [12, 7], [11, 7], [10, 6], [9, 6], [8, 5], [7, 4], [6, 4], [5, 3], [4, 2], [3, 1], [2, 1], [1, 0]];
|
|
927
|
+
// stolen from https://github.com/visgl/deck.gl/blob/master/modules/carto/src/layers/h3-tileset-2d.ts
|
|
928
|
+
// Relative scale factor (0 = no biasing, 2 = a few hexagons cover view)
|
|
929
|
+
const BIAS = 2;
|
|
930
|
+
// Resolution conversion function. Takes a WebMercatorViewport and returns
|
|
931
|
+
// a H3 resolution such that the screen space size of the hexagons is
|
|
932
|
+
// similar
|
|
933
|
+
function getHexagonResolution(viewport, tileSize) {
|
|
934
|
+
// Difference in given tile size compared to deck's internal 512px tile size,
|
|
935
|
+
// expressed as an offset to the viewport zoom.
|
|
936
|
+
const zoomOffset = Math.log2(tileSize / DEFAULT_TILE_SIZE);
|
|
937
|
+
const hexagonScaleFactor = 2 / 3 * (viewport.zoom - zoomOffset);
|
|
938
|
+
const latitudeScaleFactor = Math.log(1 / Math.cos(Math.PI * viewport.latitude / 180));
|
|
939
|
+
// Clip and bias
|
|
940
|
+
return Math.max(0, Math.floor(hexagonScaleFactor + latitudeScaleFactor - BIAS));
|
|
941
|
+
}
|
|
880
942
|
|
|
881
|
-
const _excluded = ["filterOwner", "spatialFilter", "abortController"],
|
|
882
|
-
_excluded2 = ["filterOwner", "spatialFilter", "abortController"],
|
|
883
|
-
_excluded3 = ["filterOwner", "spatialFilter", "abortController", "operationExp"],
|
|
884
|
-
_excluded4 = ["filterOwner", "spatialFilter", "abortController"],
|
|
885
|
-
_excluded5 = ["filterOwner", "spatialFilter", "abortController"],
|
|
886
|
-
_excluded6 = ["filterOwner", "spatialFilter", "abortController"],
|
|
887
|
-
_excluded7 = ["filterOwner", "spatialFilter", "abortController"],
|
|
888
|
-
_excluded8 = ["filterOwner", "abortController", "spatialFilter"];
|
|
943
|
+
const _excluded = ["filterOwner", "spatialFilter", "spatialFiltersMode", "spatialIndexReferenceViewState", "abortController"],
|
|
944
|
+
_excluded2 = ["filterOwner", "spatialFilter", "spatialFiltersMode", "spatialIndexReferenceViewState", "abortController"],
|
|
945
|
+
_excluded3 = ["filterOwner", "spatialFilter", "spatialFiltersMode", "spatialIndexReferenceViewState", "abortController", "operationExp"],
|
|
946
|
+
_excluded4 = ["filterOwner", "spatialFilter", "spatialFiltersMode", "spatialIndexReferenceViewState", "abortController"],
|
|
947
|
+
_excluded5 = ["filterOwner", "spatialFilter", "spatialFiltersMode", "spatialIndexReferenceViewState", "abortController"],
|
|
948
|
+
_excluded6 = ["filterOwner", "spatialFilter", "spatialFiltersMode", "spatialIndexReferenceViewState", "abortController"],
|
|
949
|
+
_excluded7 = ["filterOwner", "spatialFilter", "spatialFiltersMode", "spatialIndexReferenceViewState", "abortController"],
|
|
950
|
+
_excluded8 = ["filterOwner", "abortController", "spatialFilter", "spatialFiltersMode", "spatialIndexReferenceViewState"];
|
|
889
951
|
/**
|
|
890
952
|
* Source for Widget API requests on a data source defined by a SQL query.
|
|
891
953
|
*
|
|
@@ -906,9 +968,21 @@ class WidgetBaseSource {
|
|
|
906
968
|
connectionName: props.connectionName,
|
|
907
969
|
filters: getApplicableFilters(owner, props.filters),
|
|
908
970
|
filtersLogicalOperator: props.filtersLogicalOperator,
|
|
909
|
-
|
|
971
|
+
spatialDataType: props.spatialDataType,
|
|
972
|
+
spatialDataColumn: props.spatialDataColumn,
|
|
973
|
+
dataResolution: props.dataResolution
|
|
910
974
|
};
|
|
911
975
|
}
|
|
976
|
+
_getSpatialFiltersResolution(source, spatialFilter, referenceViewState) {
|
|
977
|
+
// spatialFiltersResolution applies only to spatial index sources.
|
|
978
|
+
if (!spatialFilter || source.spatialDataType === 'geo') {
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
if (!referenceViewState) {
|
|
982
|
+
throw new Error('Missing required option, "spatialIndexReferenceViewState".');
|
|
983
|
+
}
|
|
984
|
+
return getSpatialFiltersResolution(source, referenceViewState);
|
|
985
|
+
}
|
|
912
986
|
/****************************************************************************
|
|
913
987
|
* CATEGORIES
|
|
914
988
|
*/
|
|
@@ -920,6 +994,8 @@ class WidgetBaseSource {
|
|
|
920
994
|
const {
|
|
921
995
|
filterOwner,
|
|
922
996
|
spatialFilter,
|
|
997
|
+
spatialFiltersMode,
|
|
998
|
+
spatialIndexReferenceViewState,
|
|
923
999
|
abortController
|
|
924
1000
|
} = options,
|
|
925
1001
|
params = _objectWithoutPropertiesLoose(options, _excluded);
|
|
@@ -928,9 +1004,13 @@ class WidgetBaseSource {
|
|
|
928
1004
|
operation,
|
|
929
1005
|
operationColumn
|
|
930
1006
|
} = params;
|
|
1007
|
+
const source = this.getModelSource(filterOwner);
|
|
1008
|
+
const spatialFiltersResolution = this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
|
|
931
1009
|
return executeModel({
|
|
932
1010
|
model: 'category',
|
|
933
|
-
source: _extends({},
|
|
1011
|
+
source: _extends({}, source, {
|
|
1012
|
+
spatialFiltersResolution,
|
|
1013
|
+
spatialFiltersMode,
|
|
934
1014
|
spatialFilter
|
|
935
1015
|
}),
|
|
936
1016
|
params: {
|
|
@@ -958,6 +1038,8 @@ class WidgetBaseSource {
|
|
|
958
1038
|
const {
|
|
959
1039
|
filterOwner,
|
|
960
1040
|
spatialFilter,
|
|
1041
|
+
spatialFiltersMode,
|
|
1042
|
+
spatialIndexReferenceViewState,
|
|
961
1043
|
abortController
|
|
962
1044
|
} = options,
|
|
963
1045
|
params = _objectWithoutPropertiesLoose(options, _excluded2);
|
|
@@ -969,9 +1051,13 @@ class WidgetBaseSource {
|
|
|
969
1051
|
limit,
|
|
970
1052
|
tileResolution
|
|
971
1053
|
} = params;
|
|
1054
|
+
const source = this.getModelSource(filterOwner);
|
|
1055
|
+
const spatialFiltersResolution = this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
|
|
972
1056
|
return executeModel({
|
|
973
1057
|
model: 'pick',
|
|
974
|
-
source: _extends({},
|
|
1058
|
+
source: _extends({}, source, {
|
|
1059
|
+
spatialFiltersResolution,
|
|
1060
|
+
spatialFiltersMode,
|
|
975
1061
|
spatialFilter
|
|
976
1062
|
}),
|
|
977
1063
|
params: {
|
|
@@ -1003,6 +1089,8 @@ class WidgetBaseSource {
|
|
|
1003
1089
|
const {
|
|
1004
1090
|
filterOwner,
|
|
1005
1091
|
spatialFilter,
|
|
1092
|
+
spatialFiltersMode,
|
|
1093
|
+
spatialIndexReferenceViewState,
|
|
1006
1094
|
abortController,
|
|
1007
1095
|
operationExp
|
|
1008
1096
|
} = options,
|
|
@@ -1011,9 +1099,13 @@ class WidgetBaseSource {
|
|
|
1011
1099
|
column,
|
|
1012
1100
|
operation
|
|
1013
1101
|
} = params;
|
|
1102
|
+
const source = this.getModelSource(filterOwner);
|
|
1103
|
+
const spatialFiltersResolution = this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
|
|
1014
1104
|
return executeModel({
|
|
1015
1105
|
model: 'formula',
|
|
1016
|
-
source: _extends({},
|
|
1106
|
+
source: _extends({}, source, {
|
|
1107
|
+
spatialFiltersResolution,
|
|
1108
|
+
spatialFiltersMode,
|
|
1017
1109
|
spatialFilter
|
|
1018
1110
|
}),
|
|
1019
1111
|
params: {
|
|
@@ -1037,6 +1129,8 @@ class WidgetBaseSource {
|
|
|
1037
1129
|
const {
|
|
1038
1130
|
filterOwner,
|
|
1039
1131
|
spatialFilter,
|
|
1132
|
+
spatialFiltersMode,
|
|
1133
|
+
spatialIndexReferenceViewState,
|
|
1040
1134
|
abortController
|
|
1041
1135
|
} = options,
|
|
1042
1136
|
params = _objectWithoutPropertiesLoose(options, _excluded4);
|
|
@@ -1045,9 +1139,13 @@ class WidgetBaseSource {
|
|
|
1045
1139
|
operation,
|
|
1046
1140
|
ticks
|
|
1047
1141
|
} = params;
|
|
1142
|
+
const source = this.getModelSource(filterOwner);
|
|
1143
|
+
const spatialFiltersResolution = this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
|
|
1048
1144
|
const data = await executeModel({
|
|
1049
1145
|
model: 'histogram',
|
|
1050
|
-
source: _extends({},
|
|
1146
|
+
source: _extends({}, source, {
|
|
1147
|
+
spatialFiltersResolution,
|
|
1148
|
+
spatialFiltersMode,
|
|
1051
1149
|
spatialFilter
|
|
1052
1150
|
}),
|
|
1053
1151
|
params: {
|
|
@@ -1083,15 +1181,21 @@ class WidgetBaseSource {
|
|
|
1083
1181
|
const {
|
|
1084
1182
|
filterOwner,
|
|
1085
1183
|
spatialFilter,
|
|
1184
|
+
spatialFiltersMode,
|
|
1185
|
+
spatialIndexReferenceViewState,
|
|
1086
1186
|
abortController
|
|
1087
1187
|
} = options,
|
|
1088
1188
|
params = _objectWithoutPropertiesLoose(options, _excluded5);
|
|
1089
1189
|
const {
|
|
1090
1190
|
column
|
|
1091
1191
|
} = params;
|
|
1192
|
+
const source = this.getModelSource(filterOwner);
|
|
1193
|
+
const spatialFiltersResolution = this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
|
|
1092
1194
|
return executeModel({
|
|
1093
1195
|
model: 'range',
|
|
1094
|
-
source: _extends({},
|
|
1196
|
+
source: _extends({}, source, {
|
|
1197
|
+
spatialFiltersResolution,
|
|
1198
|
+
spatialFiltersMode,
|
|
1095
1199
|
spatialFilter
|
|
1096
1200
|
}),
|
|
1097
1201
|
params: {
|
|
@@ -1113,6 +1217,8 @@ class WidgetBaseSource {
|
|
|
1113
1217
|
const {
|
|
1114
1218
|
filterOwner,
|
|
1115
1219
|
spatialFilter,
|
|
1220
|
+
spatialFiltersMode,
|
|
1221
|
+
spatialIndexReferenceViewState,
|
|
1116
1222
|
abortController
|
|
1117
1223
|
} = options,
|
|
1118
1224
|
params = _objectWithoutPropertiesLoose(options, _excluded6);
|
|
@@ -1122,11 +1228,15 @@ class WidgetBaseSource {
|
|
|
1122
1228
|
yAxisColumn,
|
|
1123
1229
|
yAxisJoinOperation
|
|
1124
1230
|
} = params;
|
|
1231
|
+
const source = this.getModelSource(filterOwner);
|
|
1232
|
+
const spatialFiltersResolution = this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
|
|
1125
1233
|
// Make sure this is sync with the same constant in cloud-native/maps-api
|
|
1126
1234
|
const HARD_LIMIT = 500;
|
|
1127
1235
|
return executeModel({
|
|
1128
1236
|
model: 'scatterplot',
|
|
1129
|
-
source: _extends({},
|
|
1237
|
+
source: _extends({}, source, {
|
|
1238
|
+
spatialFiltersResolution,
|
|
1239
|
+
spatialFiltersMode,
|
|
1130
1240
|
spatialFilter
|
|
1131
1241
|
}),
|
|
1132
1242
|
params: {
|
|
@@ -1155,6 +1265,8 @@ class WidgetBaseSource {
|
|
|
1155
1265
|
const {
|
|
1156
1266
|
filterOwner,
|
|
1157
1267
|
spatialFilter,
|
|
1268
|
+
spatialFiltersMode,
|
|
1269
|
+
spatialIndexReferenceViewState,
|
|
1158
1270
|
abortController
|
|
1159
1271
|
} = options,
|
|
1160
1272
|
params = _objectWithoutPropertiesLoose(options, _excluded7);
|
|
@@ -1165,9 +1277,13 @@ class WidgetBaseSource {
|
|
|
1165
1277
|
offset = 0,
|
|
1166
1278
|
limit = 10
|
|
1167
1279
|
} = params;
|
|
1280
|
+
const source = this.getModelSource(filterOwner);
|
|
1281
|
+
const spatialFiltersResolution = this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
|
|
1168
1282
|
return executeModel({
|
|
1169
1283
|
model: 'table',
|
|
1170
|
-
source: _extends({},
|
|
1284
|
+
source: _extends({}, source, {
|
|
1285
|
+
spatialFiltersResolution,
|
|
1286
|
+
spatialFiltersMode,
|
|
1171
1287
|
spatialFilter
|
|
1172
1288
|
}),
|
|
1173
1289
|
params: {
|
|
@@ -1200,7 +1316,9 @@ class WidgetBaseSource {
|
|
|
1200
1316
|
const {
|
|
1201
1317
|
filterOwner,
|
|
1202
1318
|
abortController,
|
|
1203
|
-
spatialFilter
|
|
1319
|
+
spatialFilter,
|
|
1320
|
+
spatialFiltersMode,
|
|
1321
|
+
spatialIndexReferenceViewState
|
|
1204
1322
|
} = options,
|
|
1205
1323
|
params = _objectWithoutPropertiesLoose(options, _excluded8);
|
|
1206
1324
|
const {
|
|
@@ -1214,9 +1332,13 @@ class WidgetBaseSource {
|
|
|
1214
1332
|
splitByCategoryLimit,
|
|
1215
1333
|
splitByCategoryValues
|
|
1216
1334
|
} = params;
|
|
1335
|
+
const source = this.getModelSource(filterOwner);
|
|
1336
|
+
const spatialFiltersResolution = this._getSpatialFiltersResolution(source, spatialFilter, spatialIndexReferenceViewState);
|
|
1217
1337
|
return executeModel({
|
|
1218
1338
|
model: 'timeseries',
|
|
1219
|
-
source: _extends({},
|
|
1339
|
+
source: _extends({}, source, {
|
|
1340
|
+
spatialFiltersResolution,
|
|
1341
|
+
spatialFiltersMode,
|
|
1220
1342
|
spatialFilter
|
|
1221
1343
|
}),
|
|
1222
1344
|
params: {
|
|
@@ -1247,8 +1369,7 @@ WidgetBaseSource.defaultProps = {
|
|
|
1247
1369
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
1248
1370
|
clientId: getClient(),
|
|
1249
1371
|
filters: {},
|
|
1250
|
-
filtersLogicalOperator: 'and'
|
|
1251
|
-
geoColumn: DEFAULT_GEO_COLUMN
|
|
1372
|
+
filtersLogicalOperator: 'and'
|
|
1252
1373
|
};
|
|
1253
1374
|
|
|
1254
1375
|
/**
|
|
@@ -1323,10 +1444,11 @@ const h3QuerySource = async function h3QuerySource(options) {
|
|
|
1323
1444
|
queryParameters,
|
|
1324
1445
|
filters
|
|
1325
1446
|
} = options;
|
|
1447
|
+
const spatialDataType = 'h3';
|
|
1326
1448
|
const urlParameters = {
|
|
1327
1449
|
aggregationExp,
|
|
1328
1450
|
spatialDataColumn,
|
|
1329
|
-
spatialDataType
|
|
1451
|
+
spatialDataType,
|
|
1330
1452
|
q: sqlQuery
|
|
1331
1453
|
};
|
|
1332
1454
|
if (aggregationResLevel) {
|
|
@@ -1339,7 +1461,11 @@ const h3QuerySource = async function h3QuerySource(options) {
|
|
|
1339
1461
|
urlParameters.filters = filters;
|
|
1340
1462
|
}
|
|
1341
1463
|
return baseSource('query', options, urlParameters).then(result => _extends({}, result, {
|
|
1342
|
-
widgetSource: new WidgetQuerySource(options
|
|
1464
|
+
widgetSource: new WidgetQuerySource(_extends({}, options, {
|
|
1465
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
1466
|
+
spatialDataColumn,
|
|
1467
|
+
spatialDataType
|
|
1468
|
+
}))
|
|
1343
1469
|
}));
|
|
1344
1470
|
};
|
|
1345
1471
|
|
|
@@ -1351,11 +1477,12 @@ const h3TableSource = async function h3TableSource(options) {
|
|
|
1351
1477
|
tableName,
|
|
1352
1478
|
filters
|
|
1353
1479
|
} = options;
|
|
1480
|
+
const spatialDataType = 'h3';
|
|
1354
1481
|
const urlParameters = {
|
|
1355
1482
|
aggregationExp,
|
|
1356
1483
|
name: tableName,
|
|
1357
1484
|
spatialDataColumn,
|
|
1358
|
-
spatialDataType
|
|
1485
|
+
spatialDataType
|
|
1359
1486
|
};
|
|
1360
1487
|
if (aggregationResLevel) {
|
|
1361
1488
|
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
@@ -1364,11 +1491,17 @@ const h3TableSource = async function h3TableSource(options) {
|
|
|
1364
1491
|
urlParameters.filters = filters;
|
|
1365
1492
|
}
|
|
1366
1493
|
return baseSource('table', options, urlParameters).then(result => _extends({}, result, {
|
|
1367
|
-
widgetSource: new WidgetTableSource(options
|
|
1494
|
+
widgetSource: new WidgetTableSource(_extends({}, options, {
|
|
1495
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
1496
|
+
spatialDataColumn,
|
|
1497
|
+
spatialDataType
|
|
1498
|
+
}))
|
|
1368
1499
|
}));
|
|
1369
1500
|
};
|
|
1370
1501
|
|
|
1371
1502
|
// deck.gl
|
|
1503
|
+
// SPDX-License-Identifier: MIT
|
|
1504
|
+
// Copyright (c) vis.gl contributors
|
|
1372
1505
|
const h3TilesetSource = async function h3TilesetSource(options) {
|
|
1373
1506
|
const {
|
|
1374
1507
|
tableName
|
|
@@ -1380,6 +1513,8 @@ const h3TilesetSource = async function h3TilesetSource(options) {
|
|
|
1380
1513
|
};
|
|
1381
1514
|
|
|
1382
1515
|
// deck.gl
|
|
1516
|
+
// SPDX-License-Identifier: MIT
|
|
1517
|
+
// Copyright (c) vis.gl contributors
|
|
1383
1518
|
const rasterSource = async function rasterSource(options) {
|
|
1384
1519
|
const {
|
|
1385
1520
|
tableName,
|
|
@@ -1403,11 +1538,12 @@ const quadbinQuerySource = async function quadbinQuerySource(options) {
|
|
|
1403
1538
|
queryParameters,
|
|
1404
1539
|
filters
|
|
1405
1540
|
} = options;
|
|
1541
|
+
const spatialDataType = 'quadbin';
|
|
1406
1542
|
const urlParameters = {
|
|
1407
1543
|
aggregationExp,
|
|
1408
1544
|
q: sqlQuery,
|
|
1409
1545
|
spatialDataColumn,
|
|
1410
|
-
spatialDataType
|
|
1546
|
+
spatialDataType
|
|
1411
1547
|
};
|
|
1412
1548
|
if (aggregationResLevel) {
|
|
1413
1549
|
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
@@ -1419,7 +1555,11 @@ const quadbinQuerySource = async function quadbinQuerySource(options) {
|
|
|
1419
1555
|
urlParameters.filters = filters;
|
|
1420
1556
|
}
|
|
1421
1557
|
return baseSource('query', options, urlParameters).then(result => _extends({}, result, {
|
|
1422
|
-
widgetSource: new WidgetQuerySource(options
|
|
1558
|
+
widgetSource: new WidgetQuerySource(_extends({}, options, {
|
|
1559
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
1560
|
+
spatialDataColumn,
|
|
1561
|
+
spatialDataType
|
|
1562
|
+
}))
|
|
1423
1563
|
}));
|
|
1424
1564
|
};
|
|
1425
1565
|
|
|
@@ -1431,11 +1571,12 @@ const quadbinTableSource = async function quadbinTableSource(options) {
|
|
|
1431
1571
|
tableName,
|
|
1432
1572
|
filters
|
|
1433
1573
|
} = options;
|
|
1574
|
+
const spatialDataType = 'quadbin';
|
|
1434
1575
|
const urlParameters = {
|
|
1435
1576
|
aggregationExp,
|
|
1436
1577
|
name: tableName,
|
|
1437
1578
|
spatialDataColumn,
|
|
1438
|
-
spatialDataType
|
|
1579
|
+
spatialDataType
|
|
1439
1580
|
};
|
|
1440
1581
|
if (aggregationResLevel) {
|
|
1441
1582
|
urlParameters.aggregationResLevel = String(aggregationResLevel);
|
|
@@ -1444,11 +1585,17 @@ const quadbinTableSource = async function quadbinTableSource(options) {
|
|
|
1444
1585
|
urlParameters.filters = filters;
|
|
1445
1586
|
}
|
|
1446
1587
|
return baseSource('table', options, urlParameters).then(result => _extends({}, result, {
|
|
1447
|
-
widgetSource: new WidgetTableSource(options
|
|
1588
|
+
widgetSource: new WidgetTableSource(_extends({}, options, {
|
|
1589
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
1590
|
+
spatialDataColumn,
|
|
1591
|
+
spatialDataType
|
|
1592
|
+
}))
|
|
1448
1593
|
}));
|
|
1449
1594
|
};
|
|
1450
1595
|
|
|
1451
1596
|
// deck.gl
|
|
1597
|
+
// SPDX-License-Identifier: MIT
|
|
1598
|
+
// Copyright (c) vis.gl contributors
|
|
1452
1599
|
const quadbinTilesetSource = async function quadbinTilesetSource(options) {
|
|
1453
1600
|
const {
|
|
1454
1601
|
tableName
|
|
@@ -1469,9 +1616,10 @@ const vectorQuerySource = async function vectorQuerySource(options) {
|
|
|
1469
1616
|
queryParameters,
|
|
1470
1617
|
aggregationExp
|
|
1471
1618
|
} = options;
|
|
1619
|
+
const spatialDataType = 'geo';
|
|
1472
1620
|
const urlParameters = {
|
|
1473
1621
|
spatialDataColumn,
|
|
1474
|
-
spatialDataType
|
|
1622
|
+
spatialDataType,
|
|
1475
1623
|
tileResolution: tileResolution.toString(),
|
|
1476
1624
|
q: sqlQuery
|
|
1477
1625
|
};
|
|
@@ -1488,7 +1636,12 @@ const vectorQuerySource = async function vectorQuerySource(options) {
|
|
|
1488
1636
|
urlParameters.aggregationExp = aggregationExp;
|
|
1489
1637
|
}
|
|
1490
1638
|
return baseSource('query', options, urlParameters).then(result => _extends({}, result, {
|
|
1491
|
-
widgetSource: new WidgetQuerySource(options
|
|
1639
|
+
widgetSource: new WidgetQuerySource(_extends({}, options, {
|
|
1640
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
1641
|
+
spatialDataColumn,
|
|
1642
|
+
spatialDataType,
|
|
1643
|
+
tileResolution
|
|
1644
|
+
}))
|
|
1492
1645
|
}));
|
|
1493
1646
|
};
|
|
1494
1647
|
|
|
@@ -1501,10 +1654,11 @@ const vectorTableSource = async function vectorTableSource(options) {
|
|
|
1501
1654
|
tileResolution = DEFAULT_TILE_RESOLUTION,
|
|
1502
1655
|
aggregationExp
|
|
1503
1656
|
} = options;
|
|
1657
|
+
const spatialDataType = 'geo';
|
|
1504
1658
|
const urlParameters = {
|
|
1505
1659
|
name: tableName,
|
|
1506
1660
|
spatialDataColumn,
|
|
1507
|
-
spatialDataType
|
|
1661
|
+
spatialDataType,
|
|
1508
1662
|
tileResolution: tileResolution.toString()
|
|
1509
1663
|
};
|
|
1510
1664
|
if (columns) {
|
|
@@ -1517,11 +1671,18 @@ const vectorTableSource = async function vectorTableSource(options) {
|
|
|
1517
1671
|
urlParameters.aggregationExp = aggregationExp;
|
|
1518
1672
|
}
|
|
1519
1673
|
return baseSource('table', options, urlParameters).then(result => _extends({}, result, {
|
|
1520
|
-
widgetSource: new WidgetTableSource(options
|
|
1674
|
+
widgetSource: new WidgetTableSource(_extends({}, options, {
|
|
1675
|
+
// NOTE: Parameters with default values above must be explicitly passed here.
|
|
1676
|
+
spatialDataColumn,
|
|
1677
|
+
spatialDataType,
|
|
1678
|
+
tileResolution
|
|
1679
|
+
}))
|
|
1521
1680
|
}));
|
|
1522
1681
|
};
|
|
1523
1682
|
|
|
1524
1683
|
// deck.gl
|
|
1684
|
+
// SPDX-License-Identifier: MIT
|
|
1685
|
+
// Copyright (c) vis.gl contributors
|
|
1525
1686
|
const vectorTilesetSource = async function vectorTilesetSource(options) {
|
|
1526
1687
|
const {
|
|
1527
1688
|
tableName
|