@feltmaps/js-sdk 1.5.1 → 1.6.0-next.1
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/client.cjs +1 -1
- package/dist/client.d.cts +3 -624
- package/dist/client.d.ts +3 -624
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +192 -1
- package/dist/handler.d.ts +192 -1
- package/dist/handler.js +1 -1
- package/dist/{types-CnYUajGG.d.cts → types-0PFYQhMS.d.cts} +868 -15
- package/dist/{types-CnYUajGG.d.ts → types-0PFYQhMS.d.ts} +868 -15
- package/handler.d.ts +192 -1
- package/handler.js +1 -1
- package/package.json +1 -1
- package/{types-CnYUajGG.d.ts → types-0PFYQhMS.d.ts} +868 -15
|
@@ -13,6 +13,7 @@ type PromiseOrNot<T> = T | Promise<T>;
|
|
|
13
13
|
type zInfer<T extends {
|
|
14
14
|
shape: ZodRawShape;
|
|
15
15
|
}> = objectOutputType<T["shape"], ZodTypeAny, "strip">;
|
|
16
|
+
type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Represents a point in world coordinates.
|
|
@@ -4146,6 +4147,8 @@ interface ElementGroupChangeCallbackParams {
|
|
|
4146
4147
|
*
|
|
4147
4148
|
* The geometry can be obtained via the {@link FeltController.getGeoJsonFeature}
|
|
4148
4149
|
* method, which returns a {@link GeoJsonFeature} object.
|
|
4150
|
+
*
|
|
4151
|
+
* @group Features
|
|
4149
4152
|
*/
|
|
4150
4153
|
interface LayerFeature {
|
|
4151
4154
|
/**
|
|
@@ -4159,7 +4162,7 @@ interface LayerFeature {
|
|
|
4159
4162
|
/**
|
|
4160
4163
|
* The type of geometry of the feature.
|
|
4161
4164
|
*
|
|
4162
|
-
* @remarks Because LayerFeatures
|
|
4165
|
+
* @remarks Because LayerFeatures can be read from tiled features, it's
|
|
4163
4166
|
* possible that this `geometryType` won't match the `geometry.type` of the
|
|
4164
4167
|
* {@link GeoJsonFeature} returned by {@link FeltController.getGeoJsonFeature}.
|
|
4165
4168
|
*
|
|
@@ -4169,6 +4172,14 @@ interface LayerFeature {
|
|
|
4169
4172
|
* As a result, you should treat this property as being indicative only.
|
|
4170
4173
|
*/
|
|
4171
4174
|
geometryType: GeoJsonGeometry["type"] | (string & {});
|
|
4175
|
+
/**
|
|
4176
|
+
* The bounding box of the feature.
|
|
4177
|
+
*
|
|
4178
|
+
* @remarks Because LayerFeatures can be read from tiled features and considering
|
|
4179
|
+
* that feature geometry can go through multiple tiles, it's possible that this
|
|
4180
|
+
* is not the complete bounding box of the feature.
|
|
4181
|
+
*/
|
|
4182
|
+
bbox: FeltBoundary | undefined;
|
|
4172
4183
|
/**
|
|
4173
4184
|
* The properties of the feature, as a bag of attributes.
|
|
4174
4185
|
*/
|
|
@@ -4177,9 +4188,9 @@ interface LayerFeature {
|
|
|
4177
4188
|
/**
|
|
4178
4189
|
* A raster pixel value for a specific layer.
|
|
4179
4190
|
*
|
|
4180
|
-
* @
|
|
4191
|
+
* @group Features
|
|
4181
4192
|
*/
|
|
4182
|
-
|
|
4193
|
+
interface RasterValue {
|
|
4183
4194
|
/**
|
|
4184
4195
|
* The value of the pixel.
|
|
4185
4196
|
*/
|
|
@@ -4201,7 +4212,7 @@ type RasterValue = {
|
|
|
4201
4212
|
b: number;
|
|
4202
4213
|
a: number;
|
|
4203
4214
|
};
|
|
4204
|
-
}
|
|
4215
|
+
}
|
|
4205
4216
|
|
|
4206
4217
|
/**
|
|
4207
4218
|
* This describes the processing status of a layer.
|
|
@@ -5190,6 +5201,11 @@ declare const CreateLayersFromGeoJsonSchema: z.ZodObject<{
|
|
|
5190
5201
|
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
5191
5202
|
} | undefined;
|
|
5192
5203
|
}>;
|
|
5204
|
+
/**
|
|
5205
|
+
* The parameters for the {@link LayersController.createLayersFromGeoJson} method.
|
|
5206
|
+
*
|
|
5207
|
+
* @group Layers
|
|
5208
|
+
*/
|
|
5193
5209
|
interface CreateLayersFromGeoJsonParams extends Omit<zInfer<typeof CreateLayersFromGeoJsonSchema>, "source" | "geometryStyles"> {
|
|
5194
5210
|
/**
|
|
5195
5211
|
* The source of the GeoJSON data.
|
|
@@ -5415,6 +5431,49 @@ interface LayerFilters {
|
|
|
5415
5431
|
*/
|
|
5416
5432
|
combined: Filters;
|
|
5417
5433
|
}
|
|
5434
|
+
/**
|
|
5435
|
+
* The common type for filtering data by a spatial boundary.
|
|
5436
|
+
*
|
|
5437
|
+
* This can be either:
|
|
5438
|
+
* - `FeltBoundary`: a [w, s, e, n] bounding box
|
|
5439
|
+
* - `PolygonGeometry`: a GeoJSON Polygon geometry
|
|
5440
|
+
* - `MultiPolygonGeometry`: a GeoJSON MultiPolygon geometry
|
|
5441
|
+
* - `LngLatTuple[]`: a list of coordinates describing a single ring of a polygon
|
|
5442
|
+
*
|
|
5443
|
+
* @group Filters
|
|
5444
|
+
*/
|
|
5445
|
+
type GeometryFilter = FeltBoundary | PolygonGeometry | MultiPolygonGeometry | LngLatTuple[];
|
|
5446
|
+
|
|
5447
|
+
/**
|
|
5448
|
+
* The boundary for a layer
|
|
5449
|
+
*/
|
|
5450
|
+
type LayerBoundary = MultiPolygonGeometry;
|
|
5451
|
+
/**
|
|
5452
|
+
* All the different sources for boundaries for a layer, including their combined result.
|
|
5453
|
+
*/
|
|
5454
|
+
interface LayerBoundaries {
|
|
5455
|
+
/**
|
|
5456
|
+
* Boundaries set by drawing spatial filters on the map.
|
|
5457
|
+
*
|
|
5458
|
+
* When there are multiple spatial filters, they are combined into a multi-polygon.
|
|
5459
|
+
*/
|
|
5460
|
+
spatialFilters: LayerBoundary | null;
|
|
5461
|
+
/**
|
|
5462
|
+
* Boundaries that are set ephemerally by viewers in their own session.
|
|
5463
|
+
*
|
|
5464
|
+
* These are the filters that are set when the {@link LayersController.setLayerBoundary}
|
|
5465
|
+
* method is called. There is no way to set these in the Felt UI - they can only be
|
|
5466
|
+
* set using the SDK.
|
|
5467
|
+
*/
|
|
5468
|
+
ephemeral: LayerBoundary | null;
|
|
5469
|
+
/**
|
|
5470
|
+
* The combined result of all the boundaries set on the layer.
|
|
5471
|
+
*
|
|
5472
|
+
* Each different source of boundary is intersected to produce the combined result.
|
|
5473
|
+
*
|
|
5474
|
+
*/
|
|
5475
|
+
combined: LayerBoundary | null;
|
|
5476
|
+
}
|
|
5418
5477
|
|
|
5419
5478
|
declare const AggregateMethodSchema: z.ZodEnum<["avg", "max", "min", "sum", "median"]>;
|
|
5420
5479
|
declare const AggregationConfigSchema: z.ZodObject<{
|
|
@@ -5451,6 +5510,8 @@ declare const MutliAggregationConfigSchema: z.ZodObject<{
|
|
|
5451
5510
|
}>;
|
|
5452
5511
|
/**
|
|
5453
5512
|
* Defines how to aggregate a value across features in a layer.
|
|
5513
|
+
*
|
|
5514
|
+
* @group Stats
|
|
5454
5515
|
*/
|
|
5455
5516
|
interface AggregationConfig extends zInfer<typeof AggregationConfigSchema> {
|
|
5456
5517
|
/**
|
|
@@ -5460,11 +5521,15 @@ interface AggregationConfig extends zInfer<typeof AggregationConfigSchema> {
|
|
|
5460
5521
|
}
|
|
5461
5522
|
/**
|
|
5462
5523
|
* The method to use for the aggregation.
|
|
5524
|
+
*
|
|
5525
|
+
* @group Stats
|
|
5463
5526
|
*/
|
|
5464
5527
|
type AggregationMethod = z.infer<typeof AggregateMethodSchema>;
|
|
5465
5528
|
/**
|
|
5466
5529
|
* Defines how to aggregate a value across features in a layer with multiple aggregations
|
|
5467
5530
|
* returned at once.
|
|
5531
|
+
*
|
|
5532
|
+
* @group Stats
|
|
5468
5533
|
*/
|
|
5469
5534
|
interface MultiAggregationConfig<T extends AggregationMethod | "count"> extends zInfer<typeof MutliAggregationConfigSchema> {
|
|
5470
5535
|
methods: T[];
|
|
@@ -5476,16 +5541,6 @@ interface MultiAggregationConfig<T extends AggregationMethod | "count"> extends
|
|
|
5476
5541
|
*/
|
|
5477
5542
|
attribute?: string;
|
|
5478
5543
|
}
|
|
5479
|
-
/**
|
|
5480
|
-
* The common type for filtering data by a spatial boundary.
|
|
5481
|
-
*
|
|
5482
|
-
* This can be either:
|
|
5483
|
-
* - `FeltBoundary`: a [w, s, e, n] bounding box
|
|
5484
|
-
* - `PolygonGeometry`: a GeoJSON Polygon geometry
|
|
5485
|
-
* - `MultiPolygonGeometry`: a GeoJSON MultiPolygon geometry
|
|
5486
|
-
* - `LngLatTuple[]`: a list of coordinates describing a single ring of a polygon
|
|
5487
|
-
*/
|
|
5488
|
-
type GeometryFilter = FeltBoundary | PolygonGeometry | MultiPolygonGeometry | LngLatTuple[];
|
|
5489
5544
|
declare const ValueConfigurationSchema: z.ZodObject<{
|
|
5490
5545
|
boundary: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{
|
|
5491
5546
|
type: z.ZodLiteral<"Polygon">;
|
|
@@ -5557,6 +5612,8 @@ declare const ValueConfigurationSchema: z.ZodObject<{
|
|
|
5557
5612
|
* and `filters` properties.
|
|
5558
5613
|
*
|
|
5559
5614
|
* It can also be used to specify how to aggregate the values via the `aggregation` property.
|
|
5615
|
+
*
|
|
5616
|
+
* @group Stats
|
|
5560
5617
|
*/
|
|
5561
5618
|
interface ValueConfiguration extends zInfer<typeof ValueConfigurationSchema> {
|
|
5562
5619
|
/**
|
|
@@ -5730,6 +5787,8 @@ declare const GetLayerCategoriesParamsSchema: z.ZodObject<{
|
|
|
5730
5787
|
/**
|
|
5731
5788
|
* The parameters for getting categories from a layer, passed to
|
|
5732
5789
|
* the {@link LayersController.getCategoryData} method.
|
|
5790
|
+
*
|
|
5791
|
+
* @group Stats
|
|
5733
5792
|
*/
|
|
5734
5793
|
interface GetLayerCategoriesParams extends zInfer<typeof GetLayerCategoriesParamsSchema> {
|
|
5735
5794
|
/**
|
|
@@ -5777,6 +5836,8 @@ declare const GetLayerCategoriesGroupSchema: z.ZodObject<{
|
|
|
5777
5836
|
}>;
|
|
5778
5837
|
/**
|
|
5779
5838
|
* A single category from the response from the {@link LayersController.getCategoryData} method.
|
|
5839
|
+
*
|
|
5840
|
+
* @group Stats
|
|
5780
5841
|
*/
|
|
5781
5842
|
interface GetLayerCategoriesGroup extends zInfer<typeof GetLayerCategoriesGroupSchema> {
|
|
5782
5843
|
}
|
|
@@ -5967,6 +6028,8 @@ declare const GetLayerHistogramParamsSchema: z.ZodObject<{
|
|
|
5967
6028
|
/**
|
|
5968
6029
|
* The params used to request a histogram of values from a layer, passed to
|
|
5969
6030
|
* the {@link LayersController.getHistogramData} method.
|
|
6031
|
+
*
|
|
6032
|
+
* @group Stats
|
|
5970
6033
|
*/
|
|
5971
6034
|
interface GetLayerHistogramParams extends zInfer<typeof GetLayerHistogramParamsSchema> {
|
|
5972
6035
|
/**
|
|
@@ -6002,6 +6065,8 @@ declare const GetLayerHistogramBinSchema: z.ZodObject<{
|
|
|
6002
6065
|
}>;
|
|
6003
6066
|
/**
|
|
6004
6067
|
* One bin from the response from the {@link LayersController.getHistogramData} method.
|
|
6068
|
+
*
|
|
6069
|
+
* @group Stats
|
|
6005
6070
|
*/
|
|
6006
6071
|
interface GetLayerHistogramBin extends zInfer<typeof GetLayerHistogramBinSchema> {
|
|
6007
6072
|
}
|
|
@@ -6078,6 +6143,8 @@ declare const GetLayerCalculationParamsSchema: z.ZodObject<{
|
|
|
6078
6143
|
/**
|
|
6079
6144
|
* The parameters for calculating a single aggregate value for a layer, passed to
|
|
6080
6145
|
* the {@link LayersController.getAggregates} method.
|
|
6146
|
+
*
|
|
6147
|
+
* @group Stats
|
|
6081
6148
|
*/
|
|
6082
6149
|
interface GetLayerCalculationParams<T extends AggregationMethod | "count"> extends z.infer<typeof GetLayerCalculationParamsSchema> {
|
|
6083
6150
|
/**
|
|
@@ -6096,6 +6163,792 @@ interface GetLayerCalculationParams<T extends AggregationMethod | "count"> exten
|
|
|
6096
6163
|
aggregation: MultiAggregationConfig<T>;
|
|
6097
6164
|
}
|
|
6098
6165
|
|
|
6166
|
+
/**
|
|
6167
|
+
* The Layers controller allows you to get information about the layers on the
|
|
6168
|
+
* map, and make changes to their visibility.
|
|
6169
|
+
*
|
|
6170
|
+
* Layers can be organised into groups, and their groups can also have their
|
|
6171
|
+
* visibility toggled.
|
|
6172
|
+
*
|
|
6173
|
+
* @group Controller
|
|
6174
|
+
* @public
|
|
6175
|
+
*/
|
|
6176
|
+
interface LayersController {
|
|
6177
|
+
/**
|
|
6178
|
+
* Get a single layer from the map by its id.
|
|
6179
|
+
*
|
|
6180
|
+
* @example
|
|
6181
|
+
* ```typescript
|
|
6182
|
+
* const layer = await felt.getLayer("layer-1");
|
|
6183
|
+
* ```
|
|
6184
|
+
* @returns The requested layer.
|
|
6185
|
+
*/
|
|
6186
|
+
getLayer(
|
|
6187
|
+
/**
|
|
6188
|
+
* The id of the layer you want to get.
|
|
6189
|
+
*/
|
|
6190
|
+
id: string): Promise<Layer | null>;
|
|
6191
|
+
/**
|
|
6192
|
+
* Gets layers from the map, according to the constraints supplied. If no
|
|
6193
|
+
* constraints are supplied, all layers will be returned.
|
|
6194
|
+
*
|
|
6195
|
+
* @remarks The layers in the map, ordered by the order specified in Felt. This is not
|
|
6196
|
+
* necessarily the order that they are drawn in, as Felt draws points above
|
|
6197
|
+
* lines and lines above polygons, for instance.
|
|
6198
|
+
*
|
|
6199
|
+
* @example
|
|
6200
|
+
* ```typescript
|
|
6201
|
+
* const layers = await felt.getLayers();
|
|
6202
|
+
* ```
|
|
6203
|
+
* @returns All layers on the map.
|
|
6204
|
+
*/
|
|
6205
|
+
getLayers(
|
|
6206
|
+
/**
|
|
6207
|
+
* The constraints to apply to the layers returned from the map.
|
|
6208
|
+
*/
|
|
6209
|
+
constraint?: GetLayersConstraint): Promise<Array<Layer | null>>;
|
|
6210
|
+
/**
|
|
6211
|
+
* Hide or show layers with the given ids.
|
|
6212
|
+
*
|
|
6213
|
+
* @example
|
|
6214
|
+
* ```typescript
|
|
6215
|
+
* felt.setLayerVisibility({ show: ["layer-1", "layer-2"], hide: ["layer-3"] });
|
|
6216
|
+
* ```
|
|
6217
|
+
*/
|
|
6218
|
+
setLayerVisibility(visibility: SetVisibilityRequest): Promise<void>;
|
|
6219
|
+
/**
|
|
6220
|
+
* Set the style for a layer using FSL, the Felt Style Language.
|
|
6221
|
+
*
|
|
6222
|
+
* Changes are only for this session, and not persisted. This is useful to make
|
|
6223
|
+
* temporary changes to a layer's style, such as to highlight a particular layer
|
|
6224
|
+
* or feature.
|
|
6225
|
+
*
|
|
6226
|
+
* See the [FSL documentation](https://developers.felt.com/felt-style-language) for details
|
|
6227
|
+
* on how to read and write styles.
|
|
6228
|
+
*
|
|
6229
|
+
* If the style you set is invalid, you will receive an error explaining the problem
|
|
6230
|
+
* in the rejected promise value.
|
|
6231
|
+
*
|
|
6232
|
+
* @example
|
|
6233
|
+
* ```typescript
|
|
6234
|
+
* // first get the current style
|
|
6235
|
+
* const oldStyle = (await felt.getLayer("layer-1")).style;
|
|
6236
|
+
*
|
|
6237
|
+
* felt.setLayerStyle({ id: "layer-1", style: {
|
|
6238
|
+
* ...oldStyle,
|
|
6239
|
+
* paint: {
|
|
6240
|
+
* ...oldStyle.paint,
|
|
6241
|
+
* color: "red",
|
|
6242
|
+
* },
|
|
6243
|
+
* } });
|
|
6244
|
+
* ```
|
|
6245
|
+
*/
|
|
6246
|
+
setLayerStyle(params: {
|
|
6247
|
+
/**
|
|
6248
|
+
* The id of the layer to set the style for.
|
|
6249
|
+
*/
|
|
6250
|
+
id: string;
|
|
6251
|
+
/**
|
|
6252
|
+
* The style to set for the layer.
|
|
6253
|
+
*/
|
|
6254
|
+
style: object;
|
|
6255
|
+
}): Promise<void>;
|
|
6256
|
+
/**
|
|
6257
|
+
* Hide or show layers with the given ids from the legend.
|
|
6258
|
+
*
|
|
6259
|
+
* @example
|
|
6260
|
+
* ```typescript
|
|
6261
|
+
* felt.setLayerLegendVisibility({ show: ["layer-1", "layer-2"], hide: ["layer-3"] });
|
|
6262
|
+
* ```
|
|
6263
|
+
*/
|
|
6264
|
+
setLayerLegendVisibility(params: SetVisibilityRequest): Promise<void>;
|
|
6265
|
+
/**
|
|
6266
|
+
* Adds a listener for when a layer changes.
|
|
6267
|
+
*
|
|
6268
|
+
* @returns A function to unsubscribe from the listener
|
|
6269
|
+
*
|
|
6270
|
+
* @event
|
|
6271
|
+
* @example
|
|
6272
|
+
* ```typescript
|
|
6273
|
+
* const unsubscribe = felt.onLayerChange({
|
|
6274
|
+
* options: { id: "layer-1" },
|
|
6275
|
+
* handler: ({layer}) => console.log(layer.bounds),
|
|
6276
|
+
* });
|
|
6277
|
+
*
|
|
6278
|
+
* // later on...
|
|
6279
|
+
* unsubscribe();
|
|
6280
|
+
* ```
|
|
6281
|
+
*/
|
|
6282
|
+
onLayerChange(args: {
|
|
6283
|
+
options: {
|
|
6284
|
+
/**
|
|
6285
|
+
* The id of the layer to listen for changes to.
|
|
6286
|
+
*/
|
|
6287
|
+
id: string;
|
|
6288
|
+
};
|
|
6289
|
+
/**
|
|
6290
|
+
* The handler that is called when the layer changes.
|
|
6291
|
+
*/
|
|
6292
|
+
handler: (
|
|
6293
|
+
/**
|
|
6294
|
+
* An object describing the change that occurred.
|
|
6295
|
+
*/
|
|
6296
|
+
change: LayerChangeCallbackParams) => void;
|
|
6297
|
+
}): VoidFunction;
|
|
6298
|
+
/**
|
|
6299
|
+
* Adds layers to the map from file or URL sources.
|
|
6300
|
+
*
|
|
6301
|
+
* @remarks This allows you to add temporary layers to the map that don't depend on
|
|
6302
|
+
* any processing by Felt. This is useful for viewing data from external sources or
|
|
6303
|
+
* remote files.
|
|
6304
|
+
*
|
|
6305
|
+
* @returns The layer groups that were created.
|
|
6306
|
+
*
|
|
6307
|
+
* @example
|
|
6308
|
+
* ```typescript
|
|
6309
|
+
* const layerFromFile = await felt.createLayersFromGeoJson({
|
|
6310
|
+
* source: {
|
|
6311
|
+
* type: "geoJsonFile",
|
|
6312
|
+
* file: someFile,
|
|
6313
|
+
* },
|
|
6314
|
+
* name: "Parcels",
|
|
6315
|
+
* });
|
|
6316
|
+
*
|
|
6317
|
+
* const layerFromUrl = await felt.createLayersFromGeoJson({
|
|
6318
|
+
* source: {
|
|
6319
|
+
* sourceType: "geoJsonUrl",
|
|
6320
|
+
* url: "https://example.com/parcels.geojson",
|
|
6321
|
+
* },
|
|
6322
|
+
* name: "Parcels",
|
|
6323
|
+
* ```
|
|
6324
|
+
*/
|
|
6325
|
+
createLayersFromGeoJson(params: CreateLayersFromGeoJsonParams): Promise<{
|
|
6326
|
+
/**
|
|
6327
|
+
* The layer group that was created containing the created layers.
|
|
6328
|
+
*/
|
|
6329
|
+
layerGroup: LayerGroup;
|
|
6330
|
+
/**
|
|
6331
|
+
* The layers that were created from the source.
|
|
6332
|
+
*/
|
|
6333
|
+
layers: Array<Layer>;
|
|
6334
|
+
} | null>;
|
|
6335
|
+
/**
|
|
6336
|
+
* Update a layer by passing a subset of the layer's properties.
|
|
6337
|
+
*
|
|
6338
|
+
* Note that not all properties can be updated, so check the {@link UpdateLayerParams}
|
|
6339
|
+
* type to see which properties can be updated.
|
|
6340
|
+
*
|
|
6341
|
+
* @example
|
|
6342
|
+
* ```typescript
|
|
6343
|
+
* await felt.updateLayer({
|
|
6344
|
+
* id: "layer-1",
|
|
6345
|
+
* name: "My Layer",
|
|
6346
|
+
* caption: "A description of the layer",
|
|
6347
|
+
* });
|
|
6348
|
+
* ```
|
|
6349
|
+
*/
|
|
6350
|
+
updateLayer(params: UpdateLayerParams): Promise<Layer>;
|
|
6351
|
+
/**
|
|
6352
|
+
* Delete a layer from the map by its id.
|
|
6353
|
+
*
|
|
6354
|
+
* @remarks This only works for layers created via the SDK `createLayersFromGeoJson` method, not layers added via the Felt UI.
|
|
6355
|
+
*
|
|
6356
|
+
* @example
|
|
6357
|
+
* ```typescript
|
|
6358
|
+
* await felt.deleteLayer("layer-1");
|
|
6359
|
+
* ```
|
|
6360
|
+
*/
|
|
6361
|
+
deleteLayer(id: string): Promise<void>;
|
|
6362
|
+
/**
|
|
6363
|
+
* Get a layer group from the map by its id.
|
|
6364
|
+
*
|
|
6365
|
+
* @example
|
|
6366
|
+
* ```typescript
|
|
6367
|
+
* const layerGroup = await felt.getLayerGroup("layer-group-1");
|
|
6368
|
+
* ```
|
|
6369
|
+
* @returns The requested layer group.
|
|
6370
|
+
*/
|
|
6371
|
+
getLayerGroup(id: string): Promise<LayerGroup | null>;
|
|
6372
|
+
/**
|
|
6373
|
+
* Gets layer groups from the map, according to the constraints supplied. If no
|
|
6374
|
+
* constraints are supplied, all layer groups will be returned in rendering order.
|
|
6375
|
+
*
|
|
6376
|
+
* @example
|
|
6377
|
+
* ```typescript
|
|
6378
|
+
* const layerGroups = await felt.getLayerGroups({ ids: ["layer-group-1", "layer-group-2"] });
|
|
6379
|
+
* ```
|
|
6380
|
+
* @returns The requested layer groups.
|
|
6381
|
+
*/
|
|
6382
|
+
getLayerGroups(
|
|
6383
|
+
/**
|
|
6384
|
+
* The constraints to apply to the layer groups returned from the map.
|
|
6385
|
+
*/
|
|
6386
|
+
constraint?: GetLayerGroupsConstraint): Promise<Array<LayerGroup | null>>;
|
|
6387
|
+
/**
|
|
6388
|
+
* Hide or show layer groups with the given ids.
|
|
6389
|
+
*
|
|
6390
|
+
* @example
|
|
6391
|
+
* ```typescript
|
|
6392
|
+
* felt.setLayerGroupVisibility({ show: ["layer-group-1", "layer-group-2"], hide: ["layer-group-3"] });
|
|
6393
|
+
* ```
|
|
6394
|
+
*/
|
|
6395
|
+
setLayerGroupVisibility(visibility: SetVisibilityRequest): Promise<void>;
|
|
6396
|
+
/**
|
|
6397
|
+
* Hide or show layer groups with the given ids from the legend.
|
|
6398
|
+
*
|
|
6399
|
+
* @example
|
|
6400
|
+
* ```typescript
|
|
6401
|
+
* felt.setLayerGroupLegendVisibility({ show: ["layer-1", "layer-2"], hide: ["layer-3"] });
|
|
6402
|
+
* ```
|
|
6403
|
+
*/
|
|
6404
|
+
setLayerGroupLegendVisibility(params: SetVisibilityRequest): Promise<void>;
|
|
6405
|
+
/**
|
|
6406
|
+
* Adds a listener for when a layer group changes.
|
|
6407
|
+
*
|
|
6408
|
+
* @returns A function to unsubscribe from the listener
|
|
6409
|
+
*
|
|
6410
|
+
* @event
|
|
6411
|
+
* @example
|
|
6412
|
+
* ```typescript
|
|
6413
|
+
* const unsubscribe = felt.onLayerGroupChange({
|
|
6414
|
+
* options: { id: "layer-group-1" },
|
|
6415
|
+
* handler: ({layerGroup}) => console.log(layerGroup.id),
|
|
6416
|
+
* });
|
|
6417
|
+
*
|
|
6418
|
+
* // later on...
|
|
6419
|
+
* unsubscribe();
|
|
6420
|
+
* ```
|
|
6421
|
+
*/
|
|
6422
|
+
onLayerGroupChange(args: {
|
|
6423
|
+
options: {
|
|
6424
|
+
id: string;
|
|
6425
|
+
};
|
|
6426
|
+
handler: (change: LayerGroupChangeCallbackParams) => void;
|
|
6427
|
+
}): VoidFunction;
|
|
6428
|
+
/**
|
|
6429
|
+
* Allows you to get the state of a single legend item.
|
|
6430
|
+
*
|
|
6431
|
+
* @example
|
|
6432
|
+
* ```typescript
|
|
6433
|
+
* const legendItem = await felt.getLegendItem({
|
|
6434
|
+
* id: "legend-item-1",
|
|
6435
|
+
* layerId: "layer-1",
|
|
6436
|
+
* })
|
|
6437
|
+
* ```
|
|
6438
|
+
*/
|
|
6439
|
+
getLegendItem(id: LegendItemIdentifier): Promise<LegendItem | null>;
|
|
6440
|
+
/**
|
|
6441
|
+
* Allows you to obtain the state of several legend items, by passing in
|
|
6442
|
+
* constraints describing which legend items you want.
|
|
6443
|
+
*
|
|
6444
|
+
* If you do not pass any constraints, you will receive all legend items.
|
|
6445
|
+
*
|
|
6446
|
+
* @example
|
|
6447
|
+
* ```typescript
|
|
6448
|
+
* const legendItems = await felt.getLegendItems({layerId: "layer-1"});
|
|
6449
|
+
* ```
|
|
6450
|
+
*/
|
|
6451
|
+
getLegendItems(constraint?: LegendItemsConstraint): Promise<Array<LegendItem | null>>;
|
|
6452
|
+
/**
|
|
6453
|
+
* Hide or show legend items with the given identifiers.
|
|
6454
|
+
*
|
|
6455
|
+
* @example
|
|
6456
|
+
* ```typescript
|
|
6457
|
+
* felt.setLegendItemVisibility({
|
|
6458
|
+
* show: [{layerId: "layer-group-1", id: "item-1-0"}],
|
|
6459
|
+
* hide: [{layerId: "layer-group-2", id: "item-2-0"}],
|
|
6460
|
+
* })
|
|
6461
|
+
* ```
|
|
6462
|
+
*/
|
|
6463
|
+
setLegendItemVisibility(visibility: {
|
|
6464
|
+
show?: Array<LegendItemIdentifier>;
|
|
6465
|
+
hide?: Array<LegendItemIdentifier>;
|
|
6466
|
+
}): Promise<void>;
|
|
6467
|
+
/**
|
|
6468
|
+
* Adds a listener for when a legend item changes.
|
|
6469
|
+
*
|
|
6470
|
+
* @returns A function to unsubscribe from the listener
|
|
6471
|
+
*
|
|
6472
|
+
* @event
|
|
6473
|
+
* @example
|
|
6474
|
+
* ```typescript
|
|
6475
|
+
* const unsubscribe = felt.onLegendItemChange({
|
|
6476
|
+
* options: { layerId: "layer-1", id: "item-1-0" },
|
|
6477
|
+
* handler: ({legendItem}) => console.log(legendItem.visible),
|
|
6478
|
+
* });
|
|
6479
|
+
*
|
|
6480
|
+
* // later on...
|
|
6481
|
+
* unsubscribe();
|
|
6482
|
+
* ```
|
|
6483
|
+
*/
|
|
6484
|
+
onLegendItemChange(args: {
|
|
6485
|
+
options: LegendItemIdentifier;
|
|
6486
|
+
handler: (change: LegendItemChangeCallbackParams) => void;
|
|
6487
|
+
}): VoidFunction;
|
|
6488
|
+
/**
|
|
6489
|
+
* Get the filters for a layer.
|
|
6490
|
+
*
|
|
6491
|
+
* @remarks
|
|
6492
|
+
* The return type gives you the filters split up into the various sources
|
|
6493
|
+
* that make up the overall filters for a layer.
|
|
6494
|
+
*
|
|
6495
|
+
* @example
|
|
6496
|
+
* ```typescript
|
|
6497
|
+
* const filters = await felt.getLayerFilters("layer-1");
|
|
6498
|
+
* console.log(filters.combined, filters.style, filters.ephemeral, filters.components);
|
|
6499
|
+
* ```
|
|
6500
|
+
*/
|
|
6501
|
+
getLayerFilters(layerId: string): Promise<LayerFilters | null>;
|
|
6502
|
+
/**
|
|
6503
|
+
* Sets the **ephemeral** filters for a layer.
|
|
6504
|
+
*
|
|
6505
|
+
* @example
|
|
6506
|
+
* ```typescript
|
|
6507
|
+
* await felt.setLayerFilters({
|
|
6508
|
+
* layerId: "layer-1",
|
|
6509
|
+
* filters: ["AREA", "gt", 30_000],
|
|
6510
|
+
* });
|
|
6511
|
+
* ```
|
|
6512
|
+
*/
|
|
6513
|
+
setLayerFilters(params: {
|
|
6514
|
+
/**
|
|
6515
|
+
* The layer that you want to set the filters for.
|
|
6516
|
+
*/
|
|
6517
|
+
layerId: string;
|
|
6518
|
+
/**
|
|
6519
|
+
* The filters to set for the layer. This will replace any ephemeral filters
|
|
6520
|
+
* that are currently set for the layer.
|
|
6521
|
+
*/
|
|
6522
|
+
filters: Filters;
|
|
6523
|
+
/**
|
|
6524
|
+
* A note to display on the layer legend when this filter is applied. When the
|
|
6525
|
+
* note is shown, a reset button will also be shown, allowing the user to clear
|
|
6526
|
+
* the filter.
|
|
6527
|
+
*/
|
|
6528
|
+
note?: string;
|
|
6529
|
+
}): Promise<void>;
|
|
6530
|
+
/**
|
|
6531
|
+
* Adds a listener for when a layer's filters change.
|
|
6532
|
+
*
|
|
6533
|
+
* @returns A function to unsubscribe from the listener
|
|
6534
|
+
*
|
|
6535
|
+
* @remarks
|
|
6536
|
+
* This event fires whenever any type of filter changes on the layer, including
|
|
6537
|
+
* ephemeral filters set via the SDK, style-based filters, or filters set through
|
|
6538
|
+
* the Felt UI via Components.
|
|
6539
|
+
*
|
|
6540
|
+
* @event
|
|
6541
|
+
* @example
|
|
6542
|
+
* ```typescript
|
|
6543
|
+
* const unsubscribe = felt.onLayerFiltersChange({
|
|
6544
|
+
* options: { layerId: "layer-1" },
|
|
6545
|
+
* handler: ({combined, ephemeral, style, components}) => {
|
|
6546
|
+
* console.log("Layer filters updated:", {
|
|
6547
|
+
* combined, // All filters combined
|
|
6548
|
+
* ephemeral, // Filters set via SDK
|
|
6549
|
+
* style, // Filters from layer style
|
|
6550
|
+
* components // Filters from UI components
|
|
6551
|
+
* });
|
|
6552
|
+
* },
|
|
6553
|
+
* });
|
|
6554
|
+
*
|
|
6555
|
+
* // later on...
|
|
6556
|
+
* unsubscribe();
|
|
6557
|
+
* ```
|
|
6558
|
+
*/
|
|
6559
|
+
onLayerFiltersChange(params: {
|
|
6560
|
+
options: {
|
|
6561
|
+
layerId: string;
|
|
6562
|
+
};
|
|
6563
|
+
handler: (change: LayerFilters) => void;
|
|
6564
|
+
}): VoidFunction;
|
|
6565
|
+
/**
|
|
6566
|
+
* Get the spatial boundaries that are filtering a layer.
|
|
6567
|
+
*
|
|
6568
|
+
* @remarks
|
|
6569
|
+
* The return type gives you the boundaries split up into the various sources
|
|
6570
|
+
* that make up the overall boundary for a layer.
|
|
6571
|
+
*
|
|
6572
|
+
* The combined boundary is the intersection of the other sources of boundaries.
|
|
6573
|
+
*
|
|
6574
|
+
* @example
|
|
6575
|
+
* ```typescript
|
|
6576
|
+
* const boundaries = await felt.getLayerBoundaries("layer-1");
|
|
6577
|
+
*
|
|
6578
|
+
* console.log(boundaries?.combined);
|
|
6579
|
+
* console.log(boundaries?.spatialFilters);
|
|
6580
|
+
* console.log(boundaries?.ephemeral);
|
|
6581
|
+
* ```
|
|
6582
|
+
*/
|
|
6583
|
+
getLayerBoundaries(layerId: string): Promise<LayerBoundaries | null>;
|
|
6584
|
+
/**
|
|
6585
|
+
* Set the {@link LayerBoundaries.ephemeral | `ephemeral`} boundary for one or more layers.
|
|
6586
|
+
*
|
|
6587
|
+
* @example
|
|
6588
|
+
* ```typescript
|
|
6589
|
+
* await felt.setLayerBoundary({
|
|
6590
|
+
* layerIds: ["layer-1", "layer-2"],
|
|
6591
|
+
* boundary: { type: "MultiPolygon", coordinates: [[[100, 0], [101, 0], [101, 1], [100, 1], [100, 0]]] }
|
|
6592
|
+
* });
|
|
6593
|
+
* ```
|
|
6594
|
+
*/
|
|
6595
|
+
setLayerBoundary(params: {
|
|
6596
|
+
/**
|
|
6597
|
+
* The ids of the layers to set the boundary for.
|
|
6598
|
+
*/
|
|
6599
|
+
layerIds: Array<string>;
|
|
6600
|
+
/**
|
|
6601
|
+
* The boundary to set for the layer.
|
|
6602
|
+
*
|
|
6603
|
+
* Passing `null` clears the ephemeral boundary for the layer.
|
|
6604
|
+
*/
|
|
6605
|
+
boundary: LayerBoundary | null;
|
|
6606
|
+
}): Promise<void>;
|
|
6607
|
+
/**
|
|
6608
|
+
* Adds a listener for when a layer's spatial boundaries change.
|
|
6609
|
+
*
|
|
6610
|
+
* @returns A function to unsubscribe from the listener
|
|
6611
|
+
*
|
|
6612
|
+
* @remarks
|
|
6613
|
+
* This event fires whenever any type of spatial boundary changes on the layer, including
|
|
6614
|
+
* ephemeral boundaries set via the SDK or boundaries set through the Felt UI via
|
|
6615
|
+
* Spatial filter components.
|
|
6616
|
+
*
|
|
6617
|
+
* @event
|
|
6618
|
+
* @example
|
|
6619
|
+
* ```typescript
|
|
6620
|
+
* const unsubscribe = felt.onLayerBoundariesChange({
|
|
6621
|
+
* options: { layerId: "layer-1" },
|
|
6622
|
+
* handler: ({combined, ephemeral, spatialFilters}) => {
|
|
6623
|
+
* console.log("Layer boundaries updated:", {
|
|
6624
|
+
* combined, // All boundaries combined
|
|
6625
|
+
* ephemeral, // Boundaries set via SDK
|
|
6626
|
+
* spatialFilters // Boundaries set via UI
|
|
6627
|
+
* });
|
|
6628
|
+
* },
|
|
6629
|
+
* });
|
|
6630
|
+
*
|
|
6631
|
+
* // later on...
|
|
6632
|
+
* unsubscribe();
|
|
6633
|
+
* ```
|
|
6634
|
+
*/
|
|
6635
|
+
onLayerBoundariesChange(params: {
|
|
6636
|
+
options: {
|
|
6637
|
+
/**
|
|
6638
|
+
* The id of the layer to listen for boundary changes on.
|
|
6639
|
+
*/
|
|
6640
|
+
layerId: string;
|
|
6641
|
+
};
|
|
6642
|
+
/**
|
|
6643
|
+
* A function that is called when the boundaries change.
|
|
6644
|
+
*
|
|
6645
|
+
* @param boundaries - The new boundaries for the layer.
|
|
6646
|
+
*/
|
|
6647
|
+
handler: (boundaries: LayerBoundaries | null) => void;
|
|
6648
|
+
}): VoidFunction;
|
|
6649
|
+
/**
|
|
6650
|
+
* Get the features that are currently **rendered** on the map in the viewport.
|
|
6651
|
+
*
|
|
6652
|
+
* Note that this is explicitly about the features that are rendered, which isn't
|
|
6653
|
+
* necessarily a complete list of all the features in the viewport. This is because
|
|
6654
|
+
* of the way features are tiled: at low zoom levels or high feature densities, many
|
|
6655
|
+
* features are omitted from what is rendered on the screen.
|
|
6656
|
+
*
|
|
6657
|
+
* @example
|
|
6658
|
+
* ```typescript
|
|
6659
|
+
* const features = await felt.getRenderedFeatures();
|
|
6660
|
+
* ```
|
|
6661
|
+
*/
|
|
6662
|
+
getRenderedFeatures(
|
|
6663
|
+
/**
|
|
6664
|
+
* The constraints to apply to the features returned from the map.
|
|
6665
|
+
*/
|
|
6666
|
+
params?: GetRenderedFeaturesConstraint): Promise<Array<LayerFeature>>;
|
|
6667
|
+
/**
|
|
6668
|
+
* Get a feature from the map by its ID and layer ID.
|
|
6669
|
+
*
|
|
6670
|
+
* The response is a {@link LayerFeature} object, which does not include the
|
|
6671
|
+
* geometry of the feature.
|
|
6672
|
+
*
|
|
6673
|
+
* You may want to use this when you don't need the geometry of a feature,
|
|
6674
|
+
* but you know the ID of the feature you need.
|
|
6675
|
+
*
|
|
6676
|
+
* @example
|
|
6677
|
+
* ```typescript
|
|
6678
|
+
* const feature = await felt.getFeature({ layerId: "layer-1", id: 123 });
|
|
6679
|
+
* ```
|
|
6680
|
+
*/
|
|
6681
|
+
getFeature(params: {
|
|
6682
|
+
id: string | number;
|
|
6683
|
+
layerId: string;
|
|
6684
|
+
}): Promise<LayerFeature | null>;
|
|
6685
|
+
/**
|
|
6686
|
+
* Get a list of layer features.
|
|
6687
|
+
*
|
|
6688
|
+
* @remarks This list is paginated in sets of 20 features for each page. In order to paginate
|
|
6689
|
+
* between pages, the response includes `previousPage` and `nextPage` that are tokens
|
|
6690
|
+
* that should be sent in the `pagination` params for requesting sibling pages.
|
|
6691
|
+
*
|
|
6692
|
+
* Text search is case-insensitive and looks for matches across all feature properties.
|
|
6693
|
+
*
|
|
6694
|
+
* @returns
|
|
6695
|
+
* The response is an object which contains:
|
|
6696
|
+
* - `features`: list of {@link LayerFeature} objects, which does not include
|
|
6697
|
+
* the geometry of the feature but it does include its bounding box.
|
|
6698
|
+
* - `count`: the total number of features that match the query.
|
|
6699
|
+
* - `previousPage` & `nextPage`: The tokens to pass in the `pagination` param
|
|
6700
|
+
* to navigate between pages.
|
|
6701
|
+
*
|
|
6702
|
+
* @example
|
|
6703
|
+
* ```typescript
|
|
6704
|
+
* const page1Response = await felt.getFeatures({
|
|
6705
|
+
* layerId: "layer-1",
|
|
6706
|
+
* search: "abc123",
|
|
6707
|
+
* pagination: undefined,
|
|
6708
|
+
* });
|
|
6709
|
+
*
|
|
6710
|
+
* // Note that the search term here matches the one for the first page.
|
|
6711
|
+
* if (page1Response.nextPage) {
|
|
6712
|
+
* const page2Response = await felt.getFeatures({
|
|
6713
|
+
* layerId: "layer-1",
|
|
6714
|
+
* search: "abc123",
|
|
6715
|
+
* pagination: page1Response.nextPage,
|
|
6716
|
+
* });
|
|
6717
|
+
* }
|
|
6718
|
+
* ```
|
|
6719
|
+
*/
|
|
6720
|
+
getFeatures(params: {
|
|
6721
|
+
/**
|
|
6722
|
+
* The ID of the layer to get features from.
|
|
6723
|
+
*/
|
|
6724
|
+
layerId: string;
|
|
6725
|
+
/**
|
|
6726
|
+
* Filters to be applied. These filters will merge with layer's own filters.
|
|
6727
|
+
*/
|
|
6728
|
+
filters?: Filters;
|
|
6729
|
+
/**
|
|
6730
|
+
* Attribute to sort by.
|
|
6731
|
+
*/
|
|
6732
|
+
sorting?: SortConfig;
|
|
6733
|
+
/**
|
|
6734
|
+
* The spatial boundary to be applied.
|
|
6735
|
+
*/
|
|
6736
|
+
boundary?: GeometryFilter;
|
|
6737
|
+
/**
|
|
6738
|
+
* Search term to search by.
|
|
6739
|
+
*
|
|
6740
|
+
* Search is case-insensitive and looks for matches across all feature properties.
|
|
6741
|
+
*/
|
|
6742
|
+
search?: string;
|
|
6743
|
+
/**
|
|
6744
|
+
* Pagination token. It comes from either the `previousPage` or `nextPage`
|
|
6745
|
+
* properties of the previous response.
|
|
6746
|
+
*/
|
|
6747
|
+
pagination?: string | null;
|
|
6748
|
+
}): Promise<{
|
|
6749
|
+
/**
|
|
6750
|
+
* The list of features returned from the query.
|
|
6751
|
+
*/
|
|
6752
|
+
features: LayerFeature[];
|
|
6753
|
+
/**
|
|
6754
|
+
* The total number of features that match the query.
|
|
6755
|
+
*/
|
|
6756
|
+
count: number;
|
|
6757
|
+
/**
|
|
6758
|
+
* The pagination token to get the previous page of features.
|
|
6759
|
+
*/
|
|
6760
|
+
previousPage: string | null;
|
|
6761
|
+
/**
|
|
6762
|
+
* The pagination token to get the next page of features.
|
|
6763
|
+
*/
|
|
6764
|
+
nextPage: string | null;
|
|
6765
|
+
}>;
|
|
6766
|
+
/**
|
|
6767
|
+
* Get a feature in GeoJSON format from the map by its ID and layer ID.
|
|
6768
|
+
*
|
|
6769
|
+
* The response is a GeoJSON Feature object with the complete geometry of the
|
|
6770
|
+
* feature. Note that for some _very_ large geometries, the response may take a
|
|
6771
|
+
* long time to return, and may return a very large object.
|
|
6772
|
+
*
|
|
6773
|
+
* @example
|
|
6774
|
+
* ```typescript
|
|
6775
|
+
* const feature = await felt.getGeoJsonFeature({ layerId: "layer-1", id: 123 });
|
|
6776
|
+
* ```
|
|
6777
|
+
*/
|
|
6778
|
+
getGeoJsonFeature(params: {
|
|
6779
|
+
id: string | number;
|
|
6780
|
+
layerId: string;
|
|
6781
|
+
}): Promise<GeoJsonFeature | null>;
|
|
6782
|
+
/**
|
|
6783
|
+
* Gets values from a layer grouped by a given attribute.
|
|
6784
|
+
*
|
|
6785
|
+
* @remarks
|
|
6786
|
+
* Groups features in your layer by unique values in the specified attribute and calculates
|
|
6787
|
+
* a value for each group. By default, this value is the count of features in each group.
|
|
6788
|
+
*
|
|
6789
|
+
* You can apply filters in two ways:
|
|
6790
|
+
* 1. At the top level (using `boundary` and `filters`), which affects both what categories
|
|
6791
|
+
* are included and how values are calculated
|
|
6792
|
+
* 2. In the `values` configuration, which only affects the values but keeps all categories
|
|
6793
|
+
*
|
|
6794
|
+
* This two-level filtering is particularly useful when you want to compare subsets of data
|
|
6795
|
+
* while maintaining consistent categories. For example, you might want to show the distribution
|
|
6796
|
+
* of all building types in a city, but only count buildings built after 2000 in each category.
|
|
6797
|
+
*
|
|
6798
|
+
* @example
|
|
6799
|
+
* ```typescript
|
|
6800
|
+
* // Basic grouping: Count of buildings by type
|
|
6801
|
+
* const buildingsByType = await felt.getCategoryData({
|
|
6802
|
+
* layerId: "buildings",
|
|
6803
|
+
* attribute: "type"
|
|
6804
|
+
* });
|
|
6805
|
+
*
|
|
6806
|
+
* // Filtered grouping: Only count buildings in downtown
|
|
6807
|
+
* const downtownBuildingsByType = await felt.getCategoryData({
|
|
6808
|
+
* layerId: "buildings",
|
|
6809
|
+
* attribute: "type",
|
|
6810
|
+
* boundary: [-122.43, 47.60, -122.33, 47.62] // downtown boundary
|
|
6811
|
+
* });
|
|
6812
|
+
*
|
|
6813
|
+
* // Advanced: Show all building types, but only sum floor area of recent buildings
|
|
6814
|
+
* const recentBuildingAreaByType = await felt.getCategoryData({
|
|
6815
|
+
* layerId: "buildings",
|
|
6816
|
+
* attribute: "type",
|
|
6817
|
+
* values: {
|
|
6818
|
+
* filters: ["year_built", "gte", 2000],
|
|
6819
|
+
* aggregation: {
|
|
6820
|
+
* method: "sum",
|
|
6821
|
+
* attribute: "floor_area"
|
|
6822
|
+
* }
|
|
6823
|
+
* }
|
|
6824
|
+
* });
|
|
6825
|
+
*
|
|
6826
|
+
* // Compare residential density across neighborhoods while only counting recent buildings
|
|
6827
|
+
* const newBuildingDensityByNeighborhood = await felt.getCategoryData({
|
|
6828
|
+
* layerId: "buildings",
|
|
6829
|
+
* attribute: "neighborhood",
|
|
6830
|
+
* values: {
|
|
6831
|
+
* filters: ["year_built", "gte", 2000],
|
|
6832
|
+
* aggregation: {
|
|
6833
|
+
* method: "avg",
|
|
6834
|
+
* attribute: "units_per_acre"
|
|
6835
|
+
* }
|
|
6836
|
+
* }
|
|
6837
|
+
* });
|
|
6838
|
+
* ```
|
|
6839
|
+
*/
|
|
6840
|
+
getCategoryData(params: GetLayerCategoriesParams): Promise<Array<GetLayerCategoriesGroup>>;
|
|
6841
|
+
/**
|
|
6842
|
+
* Gets a histogram of values from a layer for a given attribute.
|
|
6843
|
+
*
|
|
6844
|
+
* @remarks
|
|
6845
|
+
* Creates bins (ranges) for numeric data and counts how many features fall into each bin,
|
|
6846
|
+
* or returns aggregated values for each bin.
|
|
6847
|
+
*
|
|
6848
|
+
* You can control how the bins are created using the `steps` parameter, choosing from
|
|
6849
|
+
* several methods like equal intervals, quantiles, or natural breaks (Jenks), or passing
|
|
6850
|
+
* in the step values directly if you know how you want to bin the data.
|
|
6851
|
+
*
|
|
6852
|
+
* Like getCategoryData, you can apply filters in two ways:
|
|
6853
|
+
* 1. At the top level (using `boundary` and `filters`), which affects both how the bins
|
|
6854
|
+
* are calculated and what features are counted in each bin
|
|
6855
|
+
* 2. In the `values` configuration, which only affects what gets counted but keeps the
|
|
6856
|
+
* bin ranges the same
|
|
6857
|
+
*
|
|
6858
|
+
* This is particularly useful when you want to compare distributions while keeping
|
|
6859
|
+
* consistent bin ranges. For example, you might want to compare the distribution of
|
|
6860
|
+
* building heights in different years while using the same height ranges.
|
|
6861
|
+
*
|
|
6862
|
+
* @example
|
|
6863
|
+
* ```typescript
|
|
6864
|
+
* // Basic histogram: Building heights in 5 natural break bins
|
|
6865
|
+
* const buildingHeights = await felt.getHistogramData({
|
|
6866
|
+
* layerId: "buildings",
|
|
6867
|
+
* attribute: "height",
|
|
6868
|
+
* steps: { type: "jenks", count: 5 }
|
|
6869
|
+
* });
|
|
6870
|
+
*
|
|
6871
|
+
* // Compare old vs new buildings using the same height ranges
|
|
6872
|
+
* const oldBuildingHeights = await felt.getHistogramData({
|
|
6873
|
+
* layerId: "buildings",
|
|
6874
|
+
* attribute: "height",
|
|
6875
|
+
* steps: [0, 20, 50, 100, 200, 500],
|
|
6876
|
+
* values: {
|
|
6877
|
+
* filters: ["year_built", "lt", 1950]
|
|
6878
|
+
* }
|
|
6879
|
+
* });
|
|
6880
|
+
*
|
|
6881
|
+
* const newBuildingHeights = await felt.getHistogramData({
|
|
6882
|
+
* layerId: "buildings",
|
|
6883
|
+
* attribute: "height",
|
|
6884
|
+
* steps: [0, 20, 50, 100, 200, 500], // Same ranges as above
|
|
6885
|
+
* values: {
|
|
6886
|
+
* filters: ["year_built", "gte", 1950]
|
|
6887
|
+
* }
|
|
6888
|
+
* });
|
|
6889
|
+
* ```
|
|
6890
|
+
*/
|
|
6891
|
+
getHistogramData(params: GetLayerHistogramParams): Promise<Array<GetLayerHistogramBin>>;
|
|
6892
|
+
/**
|
|
6893
|
+
* Calculates a single aggregate value for a layer based on the provided configuration.
|
|
6894
|
+
*
|
|
6895
|
+
* @remarks
|
|
6896
|
+
* Performs statistical calculations on your data, like counting features or computing
|
|
6897
|
+
* averages, sums, etc. You can focus your calculation on specific areas or subsets
|
|
6898
|
+
* of your data using boundaries and filters.
|
|
6899
|
+
*
|
|
6900
|
+
* When no aggregation is specified, it counts features. When an aggregation is provided,
|
|
6901
|
+
* it performs that calculation (average, sum, etc.) on the specified attribute.
|
|
6902
|
+
*
|
|
6903
|
+
* @example
|
|
6904
|
+
* ```typescript
|
|
6905
|
+
* // Count all residential buildings
|
|
6906
|
+
* const residentialCount = await felt.getAggregates({
|
|
6907
|
+
* layerId: "buildings",
|
|
6908
|
+
* filters: ["type", "eq", "residential"]
|
|
6909
|
+
* });
|
|
6910
|
+
*
|
|
6911
|
+
* // Calculate average home value in a specific neighborhood
|
|
6912
|
+
* const avgHomeValue = await felt.getAggregates({
|
|
6913
|
+
* layerId: "buildings",
|
|
6914
|
+
* boundary: [-122.43, 47.60, -122.33, 47.62], // neighborhood boundary
|
|
6915
|
+
* aggregation: {
|
|
6916
|
+
* method: "avg",
|
|
6917
|
+
* attribute: "assessed_value"
|
|
6918
|
+
* }
|
|
6919
|
+
* });
|
|
6920
|
+
*
|
|
6921
|
+
* // Find the maximum building height for buildings built after 2000
|
|
6922
|
+
* const maxNewBuildingHeight = await felt.getAggregates({
|
|
6923
|
+
* layerId: "buildings",
|
|
6924
|
+
* filters: ["year_built", "gte", 2000],
|
|
6925
|
+
* aggregation: {
|
|
6926
|
+
* method: "max",
|
|
6927
|
+
* attribute: "height"
|
|
6928
|
+
* }
|
|
6929
|
+
* });
|
|
6930
|
+
* ```
|
|
6931
|
+
*/
|
|
6932
|
+
getAggregates<T extends AggregationMethod | "count">(params: GetLayerCalculationParams<T>): Promise<Record<T, number | null>>;
|
|
6933
|
+
/**
|
|
6934
|
+
* Get the schema for a layer.
|
|
6935
|
+
*
|
|
6936
|
+
* @remarks
|
|
6937
|
+
* The schema describes the structure of the data in a layer, including the attributes
|
|
6938
|
+
* that are available on the features in the layer.
|
|
6939
|
+
*
|
|
6940
|
+
* This can be useful to build generic UIs that need to know the structure of the data in
|
|
6941
|
+
* a layer, such as a dropdown to choose an attribute.
|
|
6942
|
+
*
|
|
6943
|
+
* @example
|
|
6944
|
+
* ```typescript
|
|
6945
|
+
* const schema = await felt.getLayerSchema("layer-1");
|
|
6946
|
+
* const attributeIds = schema.attributes.map((attr) => attr.id);
|
|
6947
|
+
* ```
|
|
6948
|
+
*/
|
|
6949
|
+
getLayerSchema(layerId: string): Promise<LayerSchema>;
|
|
6950
|
+
}
|
|
6951
|
+
|
|
6099
6952
|
/**
|
|
6100
6953
|
* The event object passed to the interaction listeners.
|
|
6101
6954
|
*/
|
|
@@ -6654,4 +7507,4 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
|
|
|
6654
7507
|
bounds: [number, number, number, number];
|
|
6655
7508
|
}>;
|
|
6656
7509
|
|
|
6657
|
-
export type {
|
|
7510
|
+
export type { TextElementRead as $, MarkerElementCreate as A, MarkerElementRead as B, ConfigurableToolType as C, MarkerElementUpdate as D, Element as E, FeatureSelection as F, GeoJsonGeometry as G, HighlighterElementCreate as H, InputToolSettings as I, NoteElementRead as J, NoteElementUpdate as K, LayersController as L, MapInteractionEvent as M, NoteElementCreate as N, PathElementRead as O, PathElementCreate as P, PathElementUpdate as Q, PlaceElementCreate as R, SetVisibilityRequest as S, ToolType as T, PlaceElementRead as U, ViewportState as V, PlaceElementUpdate as W, PolygonElementCreate as X, PolygonElementRead as Y, PolygonElementUpdate as Z, TextElementCreate as _, GetElementsConstraint as a, LngLatTuple as a$, TextElementUpdate as a0, CreateLayersFromGeoJsonParams as a1, DataOnlyLayer as a2, FeltTiledVectorSource as a3, GeoJsonDataVectorSource as a4, GeoJsonFileVectorSource as a5, GeoJsonUrlVectorSource as a6, GetLayerGroupsConstraint as a7, GetLayersConstraint as a8, GetRenderedFeaturesConstraint as a9, FilterLogicGate as aA, FilterTernary as aB, Filters as aC, GeometryFilter as aD, LayerFilters as aE, LayerBoundaries as aF, LayerBoundary as aG, AggregationConfig as aH, AggregationMethod as aI, GetLayerCalculationParams as aJ, GetLayerCategoriesGroup as aK, GetLayerCategoriesParams as aL, GetLayerHistogramBin as aM, GetLayerHistogramParams as aN, MultiAggregationConfig as aO, ValueConfiguration as aP, ElementGroupNode as aQ, ElementNode as aR, FeatureNode as aS, LayerGroupNode as aT, LayerNode as aU, FeltBoundary as aV, FeltZoom as aW, GeoJsonFeature as aX, GeoJsonProperties as aY, LatLng as aZ, LineStringGeometry as a_, Layer as aa, LayerChangeCallbackParams as ab, LayerCommon as ac, LayerGroup as ad, LayerGroupChangeCallbackParams as ae, LayerProcessingStatus as af, LegendItem as ag, LegendItemChangeCallbackParams as ah, LegendItemIdentifier as ai, LegendItemsConstraint as aj, RasterBand as ak, RasterLayer as al, RasterLayerSource as am, UpdateLayerParams as an, VectorLayer as ao, LayerFeature as ap, RasterValue as aq, LayerSchema as ar, LayerSchemaAttribute as as, LayerSchemaBooleanAttribute as at, LayerSchemaCommonAttribute as au, LayerSchemaDateAttribute as av, LayerSchemaDateTimeAttribute as aw, LayerSchemaNumericAttribute as ax, LayerSchemaTextAttribute as ay, FilterExpression as az, ElementGroup as b, MultiLineStringGeometry as b0, MultiPointGeometry as b1, MultiPolygonGeometry as b2, PointGeometry as b3, PolygonGeometry as b4, SortDirection as b5, CircleToolSettings as b6, HighlighterToolSettings as b7, LineToolSettings as b8, MarkerToolSettings as b9, NoteToolSettings as ba, PinToolSettings as bb, PlaceFrame as bc, PlaceSymbol as bd, PolygonToolSettings as be, RouteToolSettings as bf, TextToolSettings as bg, UnwrapPromise as bh, UnionToIntersection as bi, PromiseOrNot as bj, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, MapDetails as h, EntityNode as i, ToolSettingsMap as j, ToolSettingsChangeEvent as k, SortConfig as l, SetViewportCenterZoomParams as m, ViewportConstraints as n, ViewportFitBoundsParams as o, ViewportCenterZoom as p, CircleElementCreate as q, CircleElementRead as r, CircleElementUpdate as s, HighlighterElementRead as t, HighlighterElementUpdate as u, ImageElementCreate as v, ImageElementRead as w, ImageElementUpdate as x, LinkElementRead as y, zInfer as z };
|