@@ -15,6 +15,9 @@ map, and make changes to their visibility.
15
15
16
16
Get a single element from the map by its id.
17
17
18
+ Use this method when you know the specific ID of an element and want to retrieve
19
+ its current state. This is more efficient than getting all elements and filtering.
20
+
18
21
### Parameters
19
22
20
23
| Parameter | Type | Description |
@@ -25,7 +28,7 @@ Get a single element from the map by its id.
25
28
26
29
` Promise ` \< ` null ` | [ ` Element ` ] ( Element.md ) >
27
30
28
- The requested element.
31
+ A promise that resolves to the requested element, or ` null ` if not found .
29
32
30
33
### Example
31
34
@@ -56,6 +59,9 @@ property of the element, with some differences:
56
59
57
60
* Text, Note and Image elements do not return geometry, so will return ` null ` .
58
61
62
+ Use this method when you need the geometric representation of an element for
63
+ spatial analysis or visualization purposes.
64
+
59
65
### Parameters
60
66
61
67
| Parameter | Type | Description |
@@ -66,6 +72,8 @@ property of the element, with some differences:
66
72
67
73
` Promise ` \< ` null ` | [ ` GeoJsonGeometry ` ] ( ../Shared/GeoJsonGeometry.md ) >
68
74
75
+ A promise that resolves to the element's geometry in GeoJSON format, or ` null ` if the element has no geometry.
76
+
69
77
### Example
70
78
71
79
``` typescript
@@ -82,17 +90,20 @@ console.log(geometry?.type, geometry?.coordinates);
82
90
Gets elements from the map, according to the constraints supplied. If no
83
91
constraints are supplied, all elements will be returned.
84
92
93
+ Use this method to retrieve multiple elements, optionally filtered by constraints.
94
+ This is useful for bulk operations or when you need to analyze all elements on the map.
95
+
85
96
### Parameters
86
97
87
- | Parameter | Type | Description |
88
- | ------------- | --------------------------------------------------- | --------------------------------------------------------------- |
89
- | ` constraint ` ? | [ ` GetElementsConstraint ` ] ( GetElementsConstraint.md ) | The constraints to apply to the elements returned from the map. |
98
+ | Parameter | Type | Description |
99
+ | ------------- | --------------------------------------------------- | -------------------------------------------------------------------- |
100
+ | ` constraint ` ? | [ ` GetElementsConstraint ` ] ( GetElementsConstraint.md ) | Optional constraints to apply to the elements returned from the map. |
90
101
91
102
### Returns
92
103
93
104
` Promise ` \< (` null ` | [ ` Element ` ] ( Element.md ) )\[ ] >
94
105
95
- All elements on the map .
106
+ A promise that resolves to an array of elements, ordered by the order specified in Felt .
96
107
97
108
### Remarks
98
109
@@ -114,17 +125,20 @@ const elements = await felt.getElements();
114
125
115
126
Get an element group from the map by its id.
116
127
128
+ Element groups allow you to organize related elements together and control
129
+ their visibility as a unit.
130
+
117
131
### Parameters
118
132
119
- | Parameter | Type |
120
- | --------- | -------- |
121
- | ` id ` | ` string ` |
133
+ | Parameter | Type | Description |
134
+ | --------- | -------- | -------------------------------------------- |
135
+ | ` id ` | ` string ` | The id of the element group you want to get. |
122
136
123
137
### Returns
124
138
125
139
` Promise ` \< ` null ` | [ ` ElementGroup ` ] ( ElementGroup.md ) >
126
140
127
- The requested element group.
141
+ A promise that resolves to the requested element group, or ` null ` if not found .
128
142
129
143
### Example
130
144
@@ -141,17 +155,20 @@ const elementGroup = await felt.getElementGroup("element-group-1");
141
155
Gets element groups from the map, according to the filters supplied. If no
142
156
constraints are supplied, all element groups will be returned in rendering order.
143
157
158
+ Use this method to retrieve multiple element groups, optionally filtered by constraints.
159
+ This is useful for bulk operations on element groups.
160
+
144
161
### Parameters
145
162
146
- | Parameter | Type | Description |
147
- | ------------- | ------------------------------------------------------------- | --------------------------------------------------------------------- |
148
- | ` constraint ` ? | [ ` GetElementGroupsConstraint ` ] ( GetElementGroupsConstraint.md ) | The constraints to apply to the element groups returned from the map. |
163
+ | Parameter | Type | Description |
164
+ | ------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------- |
165
+ | ` constraint ` ? | [ ` GetElementGroupsConstraint ` ] ( GetElementGroupsConstraint.md ) | Optional constraints to apply to the element groups returned from the map. |
149
166
150
167
### Returns
151
168
152
169
` Promise ` \< (` null ` | [ ` ElementGroup ` ] ( ElementGroup.md ) )\[ ] >
153
170
154
- The requested element groups.
171
+ A promise that resolves to an array of element groups in rendering order .
155
172
156
173
### Example
157
174
@@ -167,16 +184,21 @@ const elementGroups = await felt.getElementGroups({ ids: ["element-group-1", "el
167
184
168
185
Hide or show element groups with the given ids.
169
186
187
+ Use this method to control the visibility of multiple element groups at once.
188
+ This is more efficient than hiding/showing individual elements.
189
+
170
190
### Parameters
171
191
172
- | Parameter | Type |
173
- | ------------ | ----------------------------------------------------------- |
174
- | ` visibility ` | [ ` SetVisibilityRequest ` ] ( ../Shared/SetVisibilityRequest.md ) |
192
+ | Parameter | Type | Description |
193
+ | ------------ | ----------------------------------------------------------- | ------------------------------------------------ |
194
+ | ` visibility ` | [ ` SetVisibilityRequest ` ] ( ../Shared/SetVisibilityRequest.md ) | The visibility configuration for element groups. |
175
195
176
196
### Returns
177
197
178
198
` Promise ` \< ` void ` >
179
199
200
+ A promise that resolves when the visibility changes are applied.
201
+
180
202
### Example
181
203
182
204
``` typescript
@@ -191,16 +213,21 @@ felt.setElementGroupVisibility({ show: ["element-group-1", "element-group-2"], h
191
213
192
214
Create a new element on the map.
193
215
216
+ Use this method to programmatically create elements on the map. Elements created
217
+ via the SDK are only available to the current session and are not persisted.
218
+
194
219
### Parameters
195
220
196
- | Parameter | Type |
197
- | --------- | ----------------------------------- |
198
- | ` element ` | [ ` ElementCreate ` ] ( ElementCreate.md ) |
221
+ | Parameter | Type | Description |
222
+ | --------- | ----------------------------------- | ------------------------------------ |
223
+ | ` element ` | [ ` ElementCreate ` ] ( ElementCreate.md ) | The element configuration to create. |
199
224
200
225
### Returns
201
226
202
227
` Promise ` \< [ ` Element ` ] ( Element.md ) >
203
228
229
+ A promise that resolves to the created element.
230
+
204
231
### Example
205
232
206
233
``` typescript
@@ -215,16 +242,21 @@ const element = await felt.createElement({ type: "Place", coordinates: [10, 10]
215
242
216
243
Update an element on the map. The element type must be specified.
217
244
245
+ Use this method to modify existing elements. You can update properties like
246
+ coordinates, styling, and metadata.
247
+
218
248
### Parameters
219
249
220
- | Parameter | Type |
221
- | --------- | ----------------------------------- |
222
- | ` element ` | [ ` ElementUpdate ` ] ( ElementUpdate.md ) |
250
+ | Parameter | Type | Description |
251
+ | --------- | ----------------------------------- | --------------------------------- |
252
+ | ` element ` | [ ` ElementUpdate ` ] ( ElementUpdate.md ) | The element update configuration. |
223
253
224
254
### Returns
225
255
226
256
` Promise ` \< [ ` Element ` ] ( Element.md ) >
227
257
258
+ A promise that resolves to the updated element.
259
+
228
260
### Example
229
261
230
262
``` typescript
@@ -252,16 +284,20 @@ await felt.updateElement({
252
284
253
285
Delete an element from the map.
254
286
287
+ Use this method to remove elements from the map. This operation cannot be undone.
288
+
255
289
### Parameters
256
290
257
- | Parameter | Type |
258
- | --------- | -------- |
259
- | ` id ` | ` string ` |
291
+ | Parameter | Type | Description |
292
+ | --------- | -------- | -------------------------------- |
293
+ | ` id ` | ` string ` | The id of the element to delete. |
260
294
261
295
### Returns
262
296
263
297
` Promise ` \< ` void ` >
264
298
299
+ A promise that resolves when the element is deleted.
300
+
265
301
### Example
266
302
267
303
``` typescript
@@ -276,6 +312,18 @@ await felt.deleteElement("element-1");
276
312
277
313
Adds a listener for when an element is created.
278
314
315
+ This will fire when elements are created programmatically, or when the
316
+ user starts creating an element with a drawing tool.
317
+
318
+ When the user creates an element with a drawing tool, it can begin in
319
+ an invalid state, such as if you've just placed a single point in a polygon.
320
+
321
+ You can use the ` isBeingCreated ` property to determine if the element is
322
+ still being created by a drawing tool.
323
+
324
+ If you want to know when the element is finished being created, you can
325
+ use the [ \` onElementCreateEnd\` ] ( ElementsController.md#onelementcreateend ) listener.
326
+
279
327
### Parameters
280
328
281
329
| Parameter | Type | Description |
@@ -287,7 +335,7 @@ Adds a listener for when an element is created.
287
335
288
336
` VoidFunction `
289
337
290
- A function to unsubscribe from the listener
338
+ A function to unsubscribe from the listener.
291
339
292
340
### Example
293
341
@@ -327,7 +375,7 @@ add the marker, type a label, then finally deselect the element.
327
375
328
376
` VoidFunction `
329
377
330
- A function to unsubscribe from the listener
378
+ A function to unsubscribe from the listener.
331
379
332
380
### Example
333
381
@@ -370,7 +418,7 @@ still being created by a drawing tool.
370
418
371
419
` VoidFunction `
372
420
373
- A function to unsubscribe from the listener
421
+ A function to unsubscribe from the listener.
374
422
375
423
### Example
376
424
@@ -392,6 +440,9 @@ unsubscribe();
392
440
393
441
Adds a listener for when an element is deleted.
394
442
443
+ Use this to react to element deletions, such as cleaning up related data
444
+ or updating your application state.
445
+
395
446
### Parameters
396
447
397
448
| Parameter | Type | Description |
@@ -405,7 +456,7 @@ Adds a listener for when an element is deleted.
405
456
406
457
` VoidFunction `
407
458
408
- A function to unsubscribe from the listener
459
+ A function to unsubscribe from the listener.
409
460
410
461
### Example
411
462
@@ -427,6 +478,9 @@ unsubscribe();
427
478
428
479
Adds a listener for when an element group changes.
429
480
481
+ Use this to react to changes in element groups, such as when elements are
482
+ added to or removed from groups.
483
+
430
484
### Parameters
431
485
432
486
| Parameter | Type |
@@ -440,7 +494,7 @@ Adds a listener for when an element group changes.
440
494
441
495
` VoidFunction `
442
496
443
- A function to unsubscribe from the listener
497
+ A function to unsubscribe from the listener.
444
498
445
499
### Example
446
500
0 commit comments