@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
package/dist/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate,
|
|
2
|
-
export {
|
|
1
|
+
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, M as MapInteractionEvent, h as MapDetails, i as EntityNode, F as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, j as ToolSettingsMap, k as ToolSettingsChangeEvent, z as zInfer, l as SortConfig, V as ViewportState, m as SetViewportCenterZoomParams, n as ViewportConstraints, o as ViewportFitBoundsParams, L as LayersController, p as ViewportCenterZoom } from './types-0PFYQhMS.cjs';
|
|
2
|
+
export { aH as AggregationConfig, aI as AggregationMethod, q as CircleElementCreate, r as CircleElementRead, s as CircleElementUpdate, b6 as CircleToolSettings, a1 as CreateLayersFromGeoJsonParams, a2 as DataOnlyLayer, aQ as ElementGroupNode, aR as ElementNode, aS as FeatureNode, aV as FeltBoundary, a3 as FeltTiledVectorSource, aW as FeltZoom, az as FilterExpression, aA as FilterLogicGate, aB as FilterTernary, aC as Filters, a4 as GeoJsonDataVectorSource, aX as GeoJsonFeature, a5 as GeoJsonFileVectorSource, aY as GeoJsonProperties, a6 as GeoJsonUrlVectorSource, aD as GeometryFilter, aJ as GetLayerCalculationParams, aK as GetLayerCategoriesGroup, aL as GetLayerCategoriesParams, a7 as GetLayerGroupsConstraint, aM as GetLayerHistogramBin, aN as GetLayerHistogramParams, a8 as GetLayersConstraint, a9 as GetRenderedFeaturesConstraint, H as HighlighterElementCreate, t as HighlighterElementRead, u as HighlighterElementUpdate, b7 as HighlighterToolSettings, v as ImageElementCreate, w as ImageElementRead, x as ImageElementUpdate, aZ as LatLng, aa as Layer, aF as LayerBoundaries, aG as LayerBoundary, ab as LayerChangeCallbackParams, ac as LayerCommon, ap as LayerFeature, aE as LayerFilters, ad as LayerGroup, ae as LayerGroupChangeCallbackParams, aT as LayerGroupNode, aU as LayerNode, af as LayerProcessingStatus, ar as LayerSchema, as as LayerSchemaAttribute, at as LayerSchemaBooleanAttribute, au as LayerSchemaCommonAttribute, av as LayerSchemaDateAttribute, aw as LayerSchemaDateTimeAttribute, ax as LayerSchemaNumericAttribute, ay as LayerSchemaTextAttribute, ag as LegendItem, ah as LegendItemChangeCallbackParams, ai as LegendItemIdentifier, aj as LegendItemsConstraint, a_ as LineStringGeometry, b8 as LineToolSettings, y as LinkElementRead, a$ as LngLatTuple, A as MarkerElementCreate, B as MarkerElementRead, D as MarkerElementUpdate, b9 as MarkerToolSettings, aO as MultiAggregationConfig, b0 as MultiLineStringGeometry, b1 as MultiPointGeometry, b2 as MultiPolygonGeometry, N as NoteElementCreate, J as NoteElementRead, K as NoteElementUpdate, ba as NoteToolSettings, P as PathElementCreate, O as PathElementRead, Q as PathElementUpdate, bb as PinToolSettings, R as PlaceElementCreate, U as PlaceElementRead, W as PlaceElementUpdate, bc as PlaceFrame, bd as PlaceSymbol, b3 as PointGeometry, X as PolygonElementCreate, Y as PolygonElementRead, Z as PolygonElementUpdate, b4 as PolygonGeometry, be as PolygonToolSettings, ak as RasterBand, al as RasterLayer, am as RasterLayerSource, aq as RasterValue, bf as RouteToolSettings, b5 as SortDirection, _ as TextElementCreate, $ as TextElementRead, a0 as TextElementUpdate, bg as TextToolSettings, an as UpdateLayerParams, aP as ValueConfiguration, ao as VectorLayer } from './types-0PFYQhMS.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -311,627 +311,6 @@ interface ElementsController {
|
|
|
311
311
|
deleteElement(id: string): Promise<void>;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
/**
|
|
315
|
-
* The Layers controller allows you to get information about the layers on the
|
|
316
|
-
* map, and make changes to their visibility.
|
|
317
|
-
*
|
|
318
|
-
* Layers can be organised into groups, and their groups can also have their
|
|
319
|
-
* visibility toggled.
|
|
320
|
-
*
|
|
321
|
-
* @group Controller
|
|
322
|
-
* @public
|
|
323
|
-
*/
|
|
324
|
-
interface LayersController {
|
|
325
|
-
/**
|
|
326
|
-
* Get a single layer from the map by its id.
|
|
327
|
-
*
|
|
328
|
-
* @example
|
|
329
|
-
* ```typescript
|
|
330
|
-
* const layer = await felt.getLayer("layer-1");
|
|
331
|
-
* ```
|
|
332
|
-
* @returns The requested layer.
|
|
333
|
-
*/
|
|
334
|
-
getLayer(
|
|
335
|
-
/**
|
|
336
|
-
* The id of the layer you want to get.
|
|
337
|
-
*/
|
|
338
|
-
id: string): Promise<Layer | null>;
|
|
339
|
-
/**
|
|
340
|
-
* Gets layers from the map, according to the constraints supplied. If no
|
|
341
|
-
* constraints are supplied, all layers will be returned.
|
|
342
|
-
*
|
|
343
|
-
* @remarks The layers in the map, ordered by the order specified in Felt. This is not
|
|
344
|
-
* necessarily the order that they are drawn in, as Felt draws points above
|
|
345
|
-
* lines and lines above polygons, for instance.
|
|
346
|
-
*
|
|
347
|
-
* @example
|
|
348
|
-
* ```typescript
|
|
349
|
-
* const layers = await felt.getLayers();
|
|
350
|
-
* ```
|
|
351
|
-
* @returns All layers on the map.
|
|
352
|
-
*/
|
|
353
|
-
getLayers(
|
|
354
|
-
/**
|
|
355
|
-
* The constraints to apply to the layers returned from the map.
|
|
356
|
-
*/
|
|
357
|
-
constraint?: GetLayersConstraint): Promise<Array<Layer | null>>;
|
|
358
|
-
/**
|
|
359
|
-
* Hide or show layers with the given ids.
|
|
360
|
-
*
|
|
361
|
-
* @example
|
|
362
|
-
* ```typescript
|
|
363
|
-
* felt.setLayerVisibility({ show: ["layer-1", "layer-2"], hide: ["layer-3"] });
|
|
364
|
-
* ```
|
|
365
|
-
*/
|
|
366
|
-
setLayerVisibility(visibility: SetVisibilityRequest): Promise<void>;
|
|
367
|
-
/**
|
|
368
|
-
* Set the style for a layer using FSL, the Felt Style Language.
|
|
369
|
-
*
|
|
370
|
-
* Changes are only for this session, and not persisted. This is useful to make
|
|
371
|
-
* temporary changes to a layer's style, such as to highlight a particular layer
|
|
372
|
-
* or feature.
|
|
373
|
-
*
|
|
374
|
-
* See the [FSL documentation](https://developers.felt.com/felt-style-language) for details
|
|
375
|
-
* on how to read and write styles.
|
|
376
|
-
*
|
|
377
|
-
* If the style you set is invalid, you will receive an error explaining the problem
|
|
378
|
-
* in the rejected promise value.
|
|
379
|
-
*
|
|
380
|
-
* @example
|
|
381
|
-
* ```typescript
|
|
382
|
-
* // first get the current style
|
|
383
|
-
* const oldStyle = (await felt.getLayer("layer-1")).style;
|
|
384
|
-
*
|
|
385
|
-
* felt.setLayerStyle({ id: "layer-1", style: {
|
|
386
|
-
* ...oldStyle,
|
|
387
|
-
* paint: {
|
|
388
|
-
* ...oldStyle.paint,
|
|
389
|
-
* color: "red",
|
|
390
|
-
* },
|
|
391
|
-
* } });
|
|
392
|
-
* ```
|
|
393
|
-
*/
|
|
394
|
-
setLayerStyle(params: {
|
|
395
|
-
/**
|
|
396
|
-
* The id of the layer to set the style for.
|
|
397
|
-
*/
|
|
398
|
-
id: string;
|
|
399
|
-
/**
|
|
400
|
-
* The style to set for the layer.
|
|
401
|
-
*/
|
|
402
|
-
style: object;
|
|
403
|
-
}): Promise<void>;
|
|
404
|
-
/**
|
|
405
|
-
* Hide or show layers with the given ids from the legend.
|
|
406
|
-
*
|
|
407
|
-
* @example
|
|
408
|
-
* ```typescript
|
|
409
|
-
* felt.setLayerLegendVisibility({ show: ["layer-1", "layer-2"], hide: ["layer-3"] });
|
|
410
|
-
* ```
|
|
411
|
-
*/
|
|
412
|
-
setLayerLegendVisibility(params: SetVisibilityRequest): Promise<void>;
|
|
413
|
-
/**
|
|
414
|
-
* Adds a listener for when a layer changes.
|
|
415
|
-
*
|
|
416
|
-
* @returns A function to unsubscribe from the listener
|
|
417
|
-
*
|
|
418
|
-
* @event
|
|
419
|
-
* @example
|
|
420
|
-
* ```typescript
|
|
421
|
-
* const unsubscribe = felt.onLayerChange({
|
|
422
|
-
* options: { id: "layer-1" },
|
|
423
|
-
* handler: ({layer}) => console.log(layer.bounds),
|
|
424
|
-
* });
|
|
425
|
-
*
|
|
426
|
-
* // later on...
|
|
427
|
-
* unsubscribe();
|
|
428
|
-
* ```
|
|
429
|
-
*/
|
|
430
|
-
onLayerChange(args: {
|
|
431
|
-
options: {
|
|
432
|
-
/**
|
|
433
|
-
* The id of the layer to listen for changes to.
|
|
434
|
-
*/
|
|
435
|
-
id: string;
|
|
436
|
-
};
|
|
437
|
-
/**
|
|
438
|
-
* The handler that is called when the layer changes.
|
|
439
|
-
*/
|
|
440
|
-
handler: (
|
|
441
|
-
/**
|
|
442
|
-
* An object describing the change that occurred.
|
|
443
|
-
*/
|
|
444
|
-
change: LayerChangeCallbackParams) => void;
|
|
445
|
-
}): VoidFunction;
|
|
446
|
-
/**
|
|
447
|
-
* Adds layers to the map from file or URL sources.
|
|
448
|
-
*
|
|
449
|
-
* @remarks This allows you to add temporary layers to the map that don't depend on
|
|
450
|
-
* any processing by Felt. This is useful for viewing data from external sources or
|
|
451
|
-
* remote files.
|
|
452
|
-
*
|
|
453
|
-
* @returns The layer groups that were created.
|
|
454
|
-
*
|
|
455
|
-
* @example
|
|
456
|
-
* ```typescript
|
|
457
|
-
* const layerFromFile = await felt.createLayersFromGeoJson({
|
|
458
|
-
* source: {
|
|
459
|
-
* type: "geoJsonFile",
|
|
460
|
-
* file: someFile,
|
|
461
|
-
* },
|
|
462
|
-
* name: "Parcels",
|
|
463
|
-
* });
|
|
464
|
-
*
|
|
465
|
-
* const layerFromUrl = await felt.createLayersFromGeoJson({
|
|
466
|
-
* source: {
|
|
467
|
-
* sourceType: "geoJsonUrl",
|
|
468
|
-
* url: "https://example.com/parcels.geojson",
|
|
469
|
-
* },
|
|
470
|
-
* name: "Parcels",
|
|
471
|
-
* ```
|
|
472
|
-
*/
|
|
473
|
-
createLayersFromGeoJson(params: CreateLayersFromGeoJsonParams): Promise<{
|
|
474
|
-
/**
|
|
475
|
-
* The layer group that was created containing the created layers.
|
|
476
|
-
*/
|
|
477
|
-
layerGroup: LayerGroup;
|
|
478
|
-
/**
|
|
479
|
-
* The layers that were created from the source.
|
|
480
|
-
*/
|
|
481
|
-
layers: Array<Layer>;
|
|
482
|
-
} | null>;
|
|
483
|
-
/**
|
|
484
|
-
* Update a layer by passing a subset of the layer's properties.
|
|
485
|
-
*
|
|
486
|
-
* Note that not all properties can be updated, so check the {@link UpdateLayerParams}
|
|
487
|
-
* type to see which properties can be updated.
|
|
488
|
-
*
|
|
489
|
-
* @example
|
|
490
|
-
* ```typescript
|
|
491
|
-
* await felt.updateLayer({
|
|
492
|
-
* id: "layer-1",
|
|
493
|
-
* name: "My Layer",
|
|
494
|
-
* caption: "A description of the layer",
|
|
495
|
-
* });
|
|
496
|
-
* ```
|
|
497
|
-
*/
|
|
498
|
-
updateLayer(params: UpdateLayerParams): Promise<Layer>;
|
|
499
|
-
/**
|
|
500
|
-
* Delete a layer from the map by its id.
|
|
501
|
-
*
|
|
502
|
-
* @remarks This only works for layers created via the SDK `createLayersFromGeoJson` method, not layers added via the Felt UI.
|
|
503
|
-
*
|
|
504
|
-
* @example
|
|
505
|
-
* ```typescript
|
|
506
|
-
* await felt.deleteLayer("layer-1");
|
|
507
|
-
* ```
|
|
508
|
-
*/
|
|
509
|
-
deleteLayer(id: string): Promise<void>;
|
|
510
|
-
/**
|
|
511
|
-
* Get a layer group from the map by its id.
|
|
512
|
-
*
|
|
513
|
-
* @example
|
|
514
|
-
* ```typescript
|
|
515
|
-
* const layerGroup = await felt.getLayerGroup("layer-group-1");
|
|
516
|
-
* ```
|
|
517
|
-
* @returns The requested layer group.
|
|
518
|
-
*/
|
|
519
|
-
getLayerGroup(id: string): Promise<LayerGroup | null>;
|
|
520
|
-
/**
|
|
521
|
-
* Gets layer groups from the map, according to the constraints supplied. If no
|
|
522
|
-
* constraints are supplied, all layer groups will be returned in rendering order.
|
|
523
|
-
*
|
|
524
|
-
* @example
|
|
525
|
-
* ```typescript
|
|
526
|
-
* const layerGroups = await felt.getLayerGroups({ ids: ["layer-group-1", "layer-group-2"] });
|
|
527
|
-
* ```
|
|
528
|
-
* @returns The requested layer groups.
|
|
529
|
-
*/
|
|
530
|
-
getLayerGroups(
|
|
531
|
-
/**
|
|
532
|
-
* The constraints to apply to the layer groups returned from the map.
|
|
533
|
-
*/
|
|
534
|
-
constraint?: GetLayerGroupsConstraint): Promise<Array<LayerGroup | null>>;
|
|
535
|
-
/**
|
|
536
|
-
* Hide or show layer groups with the given ids.
|
|
537
|
-
*
|
|
538
|
-
* @example
|
|
539
|
-
* ```typescript
|
|
540
|
-
* felt.setLayerGroupVisibility({ show: ["layer-group-1", "layer-group-2"], hide: ["layer-group-3"] });
|
|
541
|
-
* ```
|
|
542
|
-
*/
|
|
543
|
-
setLayerGroupVisibility(visibility: SetVisibilityRequest): Promise<void>;
|
|
544
|
-
/**
|
|
545
|
-
* Hide or show layer groups with the given ids from the legend.
|
|
546
|
-
*
|
|
547
|
-
* @example
|
|
548
|
-
* ```typescript
|
|
549
|
-
* felt.setLayerGroupLegendVisibility({ show: ["layer-1", "layer-2"], hide: ["layer-3"] });
|
|
550
|
-
* ```
|
|
551
|
-
*/
|
|
552
|
-
setLayerGroupLegendVisibility(params: SetVisibilityRequest): Promise<void>;
|
|
553
|
-
/**
|
|
554
|
-
* Adds a listener for when a layer group changes.
|
|
555
|
-
*
|
|
556
|
-
* @returns A function to unsubscribe from the listener
|
|
557
|
-
*
|
|
558
|
-
* @event
|
|
559
|
-
* @example
|
|
560
|
-
* ```typescript
|
|
561
|
-
* const unsubscribe = felt.onLayerGroupChange({
|
|
562
|
-
* options: { id: "layer-group-1" },
|
|
563
|
-
* handler: ({layerGroup}) => console.log(layerGroup.id),
|
|
564
|
-
* });
|
|
565
|
-
*
|
|
566
|
-
* // later on...
|
|
567
|
-
* unsubscribe();
|
|
568
|
-
* ```
|
|
569
|
-
*/
|
|
570
|
-
onLayerGroupChange(args: {
|
|
571
|
-
options: {
|
|
572
|
-
id: string;
|
|
573
|
-
};
|
|
574
|
-
handler: (change: LayerGroupChangeCallbackParams) => void;
|
|
575
|
-
}): VoidFunction;
|
|
576
|
-
/**
|
|
577
|
-
* Allows you to get the state of a single legend item.
|
|
578
|
-
*
|
|
579
|
-
* @example
|
|
580
|
-
* ```typescript
|
|
581
|
-
* const legendItem = await felt.getLegendItem({
|
|
582
|
-
* id: "legend-item-1",
|
|
583
|
-
* layerId: "layer-1",
|
|
584
|
-
* })
|
|
585
|
-
* ```
|
|
586
|
-
*/
|
|
587
|
-
getLegendItem(id: LegendItemIdentifier): Promise<LegendItem | null>;
|
|
588
|
-
/**
|
|
589
|
-
* Allows you to obtain the state of several legend items, by passing in
|
|
590
|
-
* constraints describing which legend items you want.
|
|
591
|
-
*
|
|
592
|
-
* If you do not pass any constraints, you will receive all legend items.
|
|
593
|
-
*
|
|
594
|
-
* @example
|
|
595
|
-
* ```typescript
|
|
596
|
-
* const legendItems = await felt.getLegendItems({layerId: "layer-1"});
|
|
597
|
-
* ```
|
|
598
|
-
*/
|
|
599
|
-
getLegendItems(constraint?: LegendItemsConstraint): Promise<Array<LegendItem | null>>;
|
|
600
|
-
/**
|
|
601
|
-
* Hide or show legend items with the given identifiers.
|
|
602
|
-
*
|
|
603
|
-
* @example
|
|
604
|
-
* ```typescript
|
|
605
|
-
* felt.setLegendItemVisibility({
|
|
606
|
-
* show: [{layerId: "layer-group-1", id: "item-1-0"}],
|
|
607
|
-
* hide: [{layerId: "layer-group-2", id: "item-2-0"}],
|
|
608
|
-
* })
|
|
609
|
-
* ```
|
|
610
|
-
*/
|
|
611
|
-
setLegendItemVisibility(visibility: {
|
|
612
|
-
show?: Array<LegendItemIdentifier>;
|
|
613
|
-
hide?: Array<LegendItemIdentifier>;
|
|
614
|
-
}): Promise<void>;
|
|
615
|
-
/**
|
|
616
|
-
* Adds a listener for when a legend item changes.
|
|
617
|
-
*
|
|
618
|
-
* @returns A function to unsubscribe from the listener
|
|
619
|
-
*
|
|
620
|
-
* @event
|
|
621
|
-
* @example
|
|
622
|
-
* ```typescript
|
|
623
|
-
* const unsubscribe = felt.onLegendItemChange({
|
|
624
|
-
* options: { layerId: "layer-1", id: "item-1-0" },
|
|
625
|
-
* handler: ({legendItem}) => console.log(legendItem.visible),
|
|
626
|
-
* });
|
|
627
|
-
*
|
|
628
|
-
* // later on...
|
|
629
|
-
* unsubscribe();
|
|
630
|
-
* ```
|
|
631
|
-
*/
|
|
632
|
-
onLegendItemChange(args: {
|
|
633
|
-
options: LegendItemIdentifier;
|
|
634
|
-
handler: (change: LegendItemChangeCallbackParams) => void;
|
|
635
|
-
}): VoidFunction;
|
|
636
|
-
/**
|
|
637
|
-
* Get the filters for a layer.
|
|
638
|
-
*
|
|
639
|
-
* @remarks
|
|
640
|
-
* The return type gives you the filters split up into the various sources
|
|
641
|
-
* that make up the overall filters for a layer.
|
|
642
|
-
*
|
|
643
|
-
* @example
|
|
644
|
-
* ```typescript
|
|
645
|
-
* const filters = await felt.getLayerFilters("layer-1");
|
|
646
|
-
* console.log(filters.combined, filters.style, filters.ephemeral, filters.components);
|
|
647
|
-
* ```
|
|
648
|
-
*/
|
|
649
|
-
getLayerFilters(layerId: string): Promise<LayerFilters | null>;
|
|
650
|
-
/**
|
|
651
|
-
* Sets the **ephemeral** filters for a layer.
|
|
652
|
-
*
|
|
653
|
-
* @example
|
|
654
|
-
* ```typescript
|
|
655
|
-
* await felt.setLayerFilters({
|
|
656
|
-
* layerId: "layer-1",
|
|
657
|
-
* filters: ["AREA", "gt", 30_000],
|
|
658
|
-
* });
|
|
659
|
-
* ```
|
|
660
|
-
*/
|
|
661
|
-
setLayerFilters(params: {
|
|
662
|
-
/**
|
|
663
|
-
* The layer that you want to set the filters for.
|
|
664
|
-
*/
|
|
665
|
-
layerId: string;
|
|
666
|
-
/**
|
|
667
|
-
* The filters to set for the layer. This will replace any ephemeral filters
|
|
668
|
-
* that are currently set for the layer.
|
|
669
|
-
*/
|
|
670
|
-
filters: Filters;
|
|
671
|
-
/**
|
|
672
|
-
* A note to display on the layer legend when this filter is applied. When the
|
|
673
|
-
* note is shown, a reset button will also be shown, allowing the user to clear
|
|
674
|
-
* the filter.
|
|
675
|
-
*/
|
|
676
|
-
note?: string;
|
|
677
|
-
}): Promise<void>;
|
|
678
|
-
/**
|
|
679
|
-
* Adds a listener for when a layer's filters change.
|
|
680
|
-
*
|
|
681
|
-
* @returns A function to unsubscribe from the listener
|
|
682
|
-
*
|
|
683
|
-
* @remarks
|
|
684
|
-
* This event fires whenever any type of filter changes on the layer, including
|
|
685
|
-
* ephemeral filters set via the SDK, style-based filters, or filters set through
|
|
686
|
-
* the Felt UI via Components.
|
|
687
|
-
*
|
|
688
|
-
* @event
|
|
689
|
-
* @example
|
|
690
|
-
* ```typescript
|
|
691
|
-
* const unsubscribe = felt.onLayerFiltersChange({
|
|
692
|
-
* options: { layerId: "layer-1" },
|
|
693
|
-
* handler: ({combined, ephemeral, style, components}) => {
|
|
694
|
-
* console.log("Layer filters updated:", {
|
|
695
|
-
* combined, // All filters combined
|
|
696
|
-
* ephemeral, // Filters set via SDK
|
|
697
|
-
* style, // Filters from layer style
|
|
698
|
-
* components // Filters from UI components
|
|
699
|
-
* });
|
|
700
|
-
* },
|
|
701
|
-
* });
|
|
702
|
-
*
|
|
703
|
-
* // later on...
|
|
704
|
-
* unsubscribe();
|
|
705
|
-
* ```
|
|
706
|
-
*/
|
|
707
|
-
onLayerFiltersChange(params: {
|
|
708
|
-
options: {
|
|
709
|
-
layerId: string;
|
|
710
|
-
};
|
|
711
|
-
handler: (change: LayerFilters) => void;
|
|
712
|
-
}): VoidFunction;
|
|
713
|
-
/**
|
|
714
|
-
* Get the features that are currently **rendered** on the map in the viewport.
|
|
715
|
-
*
|
|
716
|
-
* Note that this is explicitly about the features that are rendered, which isn't
|
|
717
|
-
* necessarily a complete list of all the features in the viewport. This is because
|
|
718
|
-
* of the way features are tiled: at low zoom levels or high feature densities, many
|
|
719
|
-
* features are omitted from what is rendered on the screen.
|
|
720
|
-
*
|
|
721
|
-
* @example
|
|
722
|
-
* ```typescript
|
|
723
|
-
* const features = await felt.getRenderedFeatures();
|
|
724
|
-
* ```
|
|
725
|
-
*/
|
|
726
|
-
getRenderedFeatures(
|
|
727
|
-
/**
|
|
728
|
-
* The constraints to apply to the features returned from the map.
|
|
729
|
-
*/
|
|
730
|
-
params?: GetRenderedFeaturesConstraint): Promise<Array<LayerFeature>>;
|
|
731
|
-
/**
|
|
732
|
-
* Get a feature from the map by its ID and layer ID.
|
|
733
|
-
*
|
|
734
|
-
* The response is a {@link LayerFeature} object, which does not include the
|
|
735
|
-
* geometry of the feature.
|
|
736
|
-
*
|
|
737
|
-
* You may want to use this when you don't need the geometry of a feature,
|
|
738
|
-
* but you know the ID of the feature you need.
|
|
739
|
-
*
|
|
740
|
-
* @example
|
|
741
|
-
* ```typescript
|
|
742
|
-
* const feature = await felt.getFeature({ layerId: "layer-1", id: 123 });
|
|
743
|
-
* ```
|
|
744
|
-
*/
|
|
745
|
-
getFeature(params: {
|
|
746
|
-
id: string | number;
|
|
747
|
-
layerId: string;
|
|
748
|
-
}): Promise<LayerFeature | null>;
|
|
749
|
-
/**
|
|
750
|
-
* Get a feature in GeoJSON format from the map by its ID and layer ID.
|
|
751
|
-
*
|
|
752
|
-
* The response is a GeoJSON Feature object with the complete geometry of the
|
|
753
|
-
* feature. Note that for some _very_ large geometries, the response may take a
|
|
754
|
-
* long time to return, and may return a very large object.
|
|
755
|
-
*
|
|
756
|
-
* @example
|
|
757
|
-
* ```typescript
|
|
758
|
-
* const feature = await felt.getGeoJsonFeature({ layerId: "layer-1", id: 123 });
|
|
759
|
-
* ```
|
|
760
|
-
*/
|
|
761
|
-
getGeoJsonFeature(params: {
|
|
762
|
-
id: string | number;
|
|
763
|
-
layerId: string;
|
|
764
|
-
}): Promise<GeoJsonFeature | null>;
|
|
765
|
-
/**
|
|
766
|
-
* Gets values from a layer grouped by a given attribute.
|
|
767
|
-
*
|
|
768
|
-
* @remarks
|
|
769
|
-
* Groups features in your layer by unique values in the specified attribute and calculates
|
|
770
|
-
* a value for each group. By default, this value is the count of features in each group.
|
|
771
|
-
*
|
|
772
|
-
* You can apply filters in two ways:
|
|
773
|
-
* 1. At the top level (using `boundary` and `filters`), which affects both what categories
|
|
774
|
-
* are included and how values are calculated
|
|
775
|
-
* 2. In the `values` configuration, which only affects the values but keeps all categories
|
|
776
|
-
*
|
|
777
|
-
* This two-level filtering is particularly useful when you want to compare subsets of data
|
|
778
|
-
* while maintaining consistent categories. For example, you might want to show the distribution
|
|
779
|
-
* of all building types in a city, but only count buildings built after 2000 in each category.
|
|
780
|
-
*
|
|
781
|
-
* @example
|
|
782
|
-
* ```typescript
|
|
783
|
-
* // Basic grouping: Count of buildings by type
|
|
784
|
-
* const buildingsByType = await felt.getCategoryData({
|
|
785
|
-
* layerId: "buildings",
|
|
786
|
-
* attribute: "type"
|
|
787
|
-
* });
|
|
788
|
-
*
|
|
789
|
-
* // Filtered grouping: Only count buildings in downtown
|
|
790
|
-
* const downtownBuildingsByType = await felt.getCategoryData({
|
|
791
|
-
* layerId: "buildings",
|
|
792
|
-
* attribute: "type",
|
|
793
|
-
* boundary: [-122.43, 47.60, -122.33, 47.62] // downtown boundary
|
|
794
|
-
* });
|
|
795
|
-
*
|
|
796
|
-
* // Advanced: Show all building types, but only sum floor area of recent buildings
|
|
797
|
-
* const recentBuildingAreaByType = await felt.getCategoryData({
|
|
798
|
-
* layerId: "buildings",
|
|
799
|
-
* attribute: "type",
|
|
800
|
-
* values: {
|
|
801
|
-
* filters: ["year_built", "gte", 2000],
|
|
802
|
-
* aggregation: {
|
|
803
|
-
* method: "sum",
|
|
804
|
-
* attribute: "floor_area"
|
|
805
|
-
* }
|
|
806
|
-
* }
|
|
807
|
-
* });
|
|
808
|
-
*
|
|
809
|
-
* // Compare residential density across neighborhoods while only counting recent buildings
|
|
810
|
-
* const newBuildingDensityByNeighborhood = await felt.getCategoryData({
|
|
811
|
-
* layerId: "buildings",
|
|
812
|
-
* attribute: "neighborhood",
|
|
813
|
-
* values: {
|
|
814
|
-
* filters: ["year_built", "gte", 2000],
|
|
815
|
-
* aggregation: {
|
|
816
|
-
* method: "avg",
|
|
817
|
-
* attribute: "units_per_acre"
|
|
818
|
-
* }
|
|
819
|
-
* }
|
|
820
|
-
* });
|
|
821
|
-
* ```
|
|
822
|
-
*/
|
|
823
|
-
getCategoryData(params: GetLayerCategoriesParams): Promise<Array<GetLayerCategoriesGroup>>;
|
|
824
|
-
/**
|
|
825
|
-
* Gets a histogram of values from a layer for a given attribute.
|
|
826
|
-
*
|
|
827
|
-
* @remarks
|
|
828
|
-
* Creates bins (ranges) for numeric data and counts how many features fall into each bin,
|
|
829
|
-
* or returns aggregated values for each bin.
|
|
830
|
-
*
|
|
831
|
-
* You can control how the bins are created using the `steps` parameter, choosing from
|
|
832
|
-
* several methods like equal intervals, quantiles, or natural breaks (Jenks), or passing
|
|
833
|
-
* in the step values directly if you know how you want to bin the data.
|
|
834
|
-
*
|
|
835
|
-
* Like getCategoryData, you can apply filters in two ways:
|
|
836
|
-
* 1. At the top level (using `boundary` and `filters`), which affects both how the bins
|
|
837
|
-
* are calculated and what features are counted in each bin
|
|
838
|
-
* 2. In the `values` configuration, which only affects what gets counted but keeps the
|
|
839
|
-
* bin ranges the same
|
|
840
|
-
*
|
|
841
|
-
* This is particularly useful when you want to compare distributions while keeping
|
|
842
|
-
* consistent bin ranges. For example, you might want to compare the distribution of
|
|
843
|
-
* building heights in different years while using the same height ranges.
|
|
844
|
-
*
|
|
845
|
-
* @example
|
|
846
|
-
* ```typescript
|
|
847
|
-
* // Basic histogram: Building heights in 5 natural break bins
|
|
848
|
-
* const buildingHeights = await felt.getHistogramData({
|
|
849
|
-
* layerId: "buildings",
|
|
850
|
-
* attribute: "height",
|
|
851
|
-
* steps: { type: "jenks", count: 5 }
|
|
852
|
-
* });
|
|
853
|
-
*
|
|
854
|
-
* // Compare old vs new buildings using the same height ranges
|
|
855
|
-
* const oldBuildingHeights = await felt.getHistogramData({
|
|
856
|
-
* layerId: "buildings",
|
|
857
|
-
* attribute: "height",
|
|
858
|
-
* steps: [0, 20, 50, 100, 200, 500],
|
|
859
|
-
* values: {
|
|
860
|
-
* filters: ["year_built", "lt", 1950]
|
|
861
|
-
* }
|
|
862
|
-
* });
|
|
863
|
-
*
|
|
864
|
-
* const newBuildingHeights = await felt.getHistogramData({
|
|
865
|
-
* layerId: "buildings",
|
|
866
|
-
* attribute: "height",
|
|
867
|
-
* steps: [0, 20, 50, 100, 200, 500], // Same ranges as above
|
|
868
|
-
* values: {
|
|
869
|
-
* filters: ["year_built", "gte", 1950]
|
|
870
|
-
* }
|
|
871
|
-
* });
|
|
872
|
-
* ```
|
|
873
|
-
*/
|
|
874
|
-
getHistogramData(params: GetLayerHistogramParams): Promise<Array<GetLayerHistogramBin>>;
|
|
875
|
-
/**
|
|
876
|
-
* Calculates a single aggregate value for a layer based on the provided configuration.
|
|
877
|
-
*
|
|
878
|
-
* @remarks
|
|
879
|
-
* Performs statistical calculations on your data, like counting features or computing
|
|
880
|
-
* averages, sums, etc. You can focus your calculation on specific areas or subsets
|
|
881
|
-
* of your data using boundaries and filters.
|
|
882
|
-
*
|
|
883
|
-
* When no aggregation is specified, it counts features. When an aggregation is provided,
|
|
884
|
-
* it performs that calculation (average, sum, etc.) on the specified attribute.
|
|
885
|
-
*
|
|
886
|
-
* @example
|
|
887
|
-
* ```typescript
|
|
888
|
-
* // Count all residential buildings
|
|
889
|
-
* const residentialCount = await felt.getAggregates({
|
|
890
|
-
* layerId: "buildings",
|
|
891
|
-
* filters: ["type", "eq", "residential"]
|
|
892
|
-
* });
|
|
893
|
-
*
|
|
894
|
-
* // Calculate average home value in a specific neighborhood
|
|
895
|
-
* const avgHomeValue = await felt.getAggregates({
|
|
896
|
-
* layerId: "buildings",
|
|
897
|
-
* boundary: [-122.43, 47.60, -122.33, 47.62], // neighborhood boundary
|
|
898
|
-
* aggregation: {
|
|
899
|
-
* method: "avg",
|
|
900
|
-
* attribute: "assessed_value"
|
|
901
|
-
* }
|
|
902
|
-
* });
|
|
903
|
-
*
|
|
904
|
-
* // Find the maximum building height for buildings built after 2000
|
|
905
|
-
* const maxNewBuildingHeight = await felt.getAggregates({
|
|
906
|
-
* layerId: "buildings",
|
|
907
|
-
* filters: ["year_built", "gte", 2000],
|
|
908
|
-
* aggregation: {
|
|
909
|
-
* method: "max",
|
|
910
|
-
* attribute: "height"
|
|
911
|
-
* }
|
|
912
|
-
* });
|
|
913
|
-
* ```
|
|
914
|
-
*/
|
|
915
|
-
getAggregates<T extends AggregationMethod | "count">(params: GetLayerCalculationParams<T>): Promise<Record<T, number | null>>;
|
|
916
|
-
/**
|
|
917
|
-
* Get the schema for a layer.
|
|
918
|
-
*
|
|
919
|
-
* @remarks
|
|
920
|
-
* The schema describes the structure of the data in a layer, including the attributes
|
|
921
|
-
* that are available on the features in the layer.
|
|
922
|
-
*
|
|
923
|
-
* This can be useful to build generic UIs that need to know the structure of the data in
|
|
924
|
-
* a layer, such as a dropdown to choose an attribute.
|
|
925
|
-
*
|
|
926
|
-
* @example
|
|
927
|
-
* ```typescript
|
|
928
|
-
* const schema = await felt.getLayerSchema("layer-1");
|
|
929
|
-
* const attributeIds = schema.attributes.map((attr) => attr.id);
|
|
930
|
-
* ```
|
|
931
|
-
*/
|
|
932
|
-
getLayerSchema(layerId: string): Promise<LayerSchema>;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
314
|
/**
|
|
936
315
|
* The Interactions controller allows you to observe interactions with the map
|
|
937
316
|
*
|
|
@@ -1795,4 +1174,4 @@ declare const Felt: {
|
|
|
1795
1174
|
connect(feltWindow: Pick<Window, "postMessage">): Promise<FeltController>;
|
|
1796
1175
|
};
|
|
1797
1176
|
|
|
1798
|
-
export {
|
|
1177
|
+
export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, GeoJsonGeometry, GetElementGroupsConstraint, GetElementsConstraint, InputToolSettings, type InteractionsController, LayersController, MapDetails, MapInteractionEvent, type MiscController, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, SortConfig, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
|