• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ngageoint / geopackage-js / 4077982532

pending completion
4077982532

push

github

Christopher Caldwell
readme update and some minor updates

3593 of 8015 branches covered (44.83%)

Branch coverage included in aggregate %.

8 of 8 new or added lines in 4 files covered. (100.0%)

15102 of 20471 relevant lines covered (73.77%)

1561.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.32
/lib/features/user/manualFeatureQuery.ts
1
import { Projection } from '@ngageoint/projections-js';
2
import { BoundingBox } from '../../boundingBox';
1✔
3
import { FieldValues } from '../../dao/fieldValues';
4
import { SQLUtils } from '../../db/sqlUtils';
1✔
5
import { FeatureDao } from './featureDao';
6
import { FeatureResultSet } from './featureResultSet';
7
import { ManualFeatureQueryResults } from './manualFeatureQueryResults';
1✔
8
import { DBValue } from '../../db/dbValue';
9
import { GeometryEnvelope } from '@ngageoint/simple-features-js';
10
import { FeatureRow } from './featureRow';
11
import { GeometryTransform } from '@ngageoint/simple-features-proj-js';
1✔
12

13
/**
14
 * Performs manual brute force queries against feature rows. See
15
 * {@link FeatureIndexManager} for performing indexed queries.
16
 */
17
export class ManualFeatureQuery {
1✔
18
  /**
19
   * Feature DAO
20
   */
21
  private readonly featureDao: FeatureDao;
22

23
  /**
24
   * Query single chunk limit
25
   */
26
  protected chunkLimit = 1000;
98✔
27

28
  /**
29
   * Query range tolerance
30
   */
31
  protected tolerance = 0.00000000000001;
98✔
32

33
  /**
34
   * Constructor
35
   * @param featureDao feature DAO
36
   */
37
  public constructor(featureDao: FeatureDao) {
38
    this.featureDao = featureDao;
98✔
39
  }
40

41
  /**
42
   * Get the feature DAO
43
   * @return feature DAO
44
   */
45
  public getFeatureDao(): FeatureDao {
1✔
46
    return this.featureDao;
×
47
  }
48

49
  /**
50
   * Get the SQL query chunk limit
51
   * @return chunk limit
52
   */
53
  public getChunkLimit(): number {
1✔
54
    return this.chunkLimit;
×
55
  }
56

57
  /**
58
   * Set the SQL query chunk limit
59
   * @param chunkLimit chunk limit
60
   */
61
  public setChunkLimit(chunkLimit: number): void {
1✔
62
    this.chunkLimit = chunkLimit;
×
63
  }
64

65
  /**
66
   * Get the query range tolerance
67
   * @return query range tolerance
68
   */
69
  public getTolerance(): number {
1✔
70
    return this.tolerance;
×
71
  }
72

73
  /**
74
   * Set the query range tolerance
75
   * @param tolerance query range tolerance
76
   */
77
  public setTolerance(tolerance: number): void {
1✔
78
    this.tolerance = tolerance;
×
79
  }
80

81
  /**
82
   * Query
83
   * @param where
84
   * @param whereArgs
85
   * @param join
86
   * @param groupBy
87
   * @param having
88
   * @param orderBy
89
   * @param limit
90
   * @param offset
91
   */
92
  public query(
1✔
93
    where?: string,
94
    whereArgs?: any[],
95
    join?: string,
96
    groupBy?: string,
97
    having?: string,
98
    orderBy?: string,
99
    limit?: number,
100
    offset?: number,
101
  ): FeatureResultSet {
102
    return this.featureDao.query(where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
103
  }
104

105
  /**
106
   * Query
107
   * @param distinct
108
   * @param where
109
   * @param whereArgs
110
   * @param join
111
   * @param groupBy
112
   * @param having
113
   * @param orderBy
114
   * @param limit
115
   * @param offset
116
   */
117
  public queryWithDistinct(
1✔
118
    distinct: boolean,
119
    where?: string,
120
    whereArgs?: any[],
121
    join?: string,
122
    groupBy?: string,
123
    having?: string,
124
    orderBy?: string,
125
    limit?: number,
126
    offset?: number,
127
  ): FeatureResultSet {
128
    return this.featureDao.queryWithDistinct(distinct, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
129
  }
130

131
  /**
132
   * Query
133
   * @param columns
134
   * @param where
135
   * @param whereArgs
136
   * @param join
137
   * @param groupBy
138
   * @param having
139
   * @param orderBy
140
   * @param limit
141
   * @param offset
142
   */
143
  public queryWithColumns(
1✔
144
    columns: string[],
145
    where?: string,
146
    whereArgs?: any[],
147
    join?: string,
148
    groupBy?: string,
149
    having?: string,
150
    orderBy?: string,
151
    limit?: number,
152
    offset?: number,
153
  ): FeatureResultSet {
154
    return this.featureDao.queryWithColumns(columns, where, whereArgs, join, groupBy, having, orderBy, limit, offset);
×
155
  }
156

157
  /**
158
   * Query
159
   * @param distinct
160
   * @param columns
161
   * @param where
162
   * @param whereArgs
163
   * @param join
164
   * @param groupBy
165
   * @param having
166
   * @param orderBy
167
   * @param limit
168
   * @param offset
169
   */
170
  public queryWithDistinctAndColumns(
1✔
171
    distinct = false,
4!
172
    columns: string[] = this.featureDao.getColumnNames(),
4!
173
    where?: string,
174
    whereArgs?: any[],
175
    join?: string,
176
    groupBy?: string,
177
    having?: string,
178
    orderBy?: string,
179
    limit?: number,
180
    offset?: number,
181
  ): FeatureResultSet {
182
    return this.featureDao.queryWithDistinctAndColumns(
2✔
183
      distinct,
184
      columns,
185
      where,
186
      whereArgs,
187
      join,
188
      groupBy,
189
      having,
190
      orderBy,
191
      limit,
192
      offset,
193
    );
194
  }
195

196
  /**
197
   * Count of feature rows
198
   * @param where
199
   * @param whereArgs
200
   * @param join
201
   * @param groupBy
202
   * @param having
203
   * @param orderBy
204
   * @param limit
205
   * @param offset
206
   */
207
  public count(
1✔
208
    where?: string,
209
    whereArgs?: [] | DBValue[],
210
    join?: string,
211
    groupBy?: string,
212
    having?: string,
213
    orderBy?: string,
214
    limit?: number,
215
    offset?: number,
216
  ): number {
217
    return this.countWithDistinctAndColumns(
×
218
      undefined,
219
      undefined,
220
      where,
221
      whereArgs,
222
      join,
223
      groupBy,
224
      having,
225
      orderBy,
226
      limit,
227
      offset,
228
    );
229
  }
230

231
  /**
232
   * Count of feature rows
233
   * @param distinct
234
   * @param where
235
   * @param whereArgs
236
   * @param join
237
   * @param groupBy
238
   * @param having
239
   * @param orderBy
240
   * @param limit
241
   * @param offset
242
   */
243
  public countWithDistinct(
1✔
244
    distinct = false,
×
245
    where?: string,
246
    whereArgs?: [] | DBValue[],
247
    join?: string,
248
    groupBy?: string,
249
    having?: string,
250
    orderBy?: string,
251
    limit?: number,
252
    offset?: number,
253
  ): number {
254
    return this.countWithDistinctAndColumns(
×
255
      distinct,
256
      undefined,
257
      where,
258
      whereArgs,
259
      join,
260
      groupBy,
261
      having,
262
      orderBy,
263
      limit,
264
      offset,
265
    );
266
  }
267

268
  /**
269
   * Count of feature rows
270
   * @param columns
271
   * @param where
272
   * @param whereArgs
273
   * @param join
274
   * @param groupBy
275
   * @param having
276
   * @param orderBy
277
   * @param limit
278
   * @param offset
279
   */
280
  public countWithColumns(
1✔
281
    columns: string[] = this.featureDao.getColumnNames(),
×
282
    where?: string,
283
    whereArgs?: [] | DBValue[],
284
    join?: string,
285
    groupBy?: string,
286
    having?: string,
287
    orderBy?: string,
288
    limit?: number,
289
    offset?: number,
290
  ): number {
291
    return this.countWithDistinctAndColumns(
×
292
      undefined,
293
      columns,
294
      where,
295
      whereArgs,
296
      join,
297
      groupBy,
298
      having,
299
      orderBy,
300
      limit,
301
      offset,
302
    );
303
  }
304

305
  /**
306
   * Count of feature rows
307
   * @param distinct
308
   * @param columns
309
   * @param where
310
   * @param whereArgs
311
   * @param join
312
   * @param groupBy
313
   * @param having
314
   * @param orderBy
315
   * @param limit
316
   * @param offset
317
   */
318
  public countWithDistinctAndColumns(
1✔
319
    distinct = false,
×
320
    columns: string[] = this.featureDao.getColumnNames(),
×
321
    where?: string,
322
    whereArgs?: [] | DBValue[],
323
    join?: string,
324
    groupBy?: string,
325
    having?: string,
326
    orderBy?: string,
327
    limit?: number,
328
    offset?: number,
329
  ): number {
330
    return this.featureDao.countWithDistinctAndColumns(
×
331
      distinct,
332
      columns,
333
      where,
334
      whereArgs,
335
      join,
336
      groupBy,
337
      having,
338
      orderBy,
339
      limit,
340
      offset,
341
    );
342
  }
343

344
  /**
345
   * Get the count of features with non null geometries
346
   *
347
   * @return count
348
   */
349
  public countWithGeometries(): number {
1✔
350
    return this.featureDao.count(SQLUtils.quoteWrap(this.featureDao.getGeometryColumnName()) + ' IS NOT NULL');
×
351
  }
352

353
  /**
354
   * Get a count of results
355
   *
356
   * @param distinct
357
   * @param column count column name
358
   * @return count
359
   */
360
  public countColumn(distinct = false, column: string): number {
1!
361
    return this.featureDao.countColumn(distinct, column, undefined, undefined);
×
362
  }
363

364
  /**
365
   * Query for features
366
   * @param fieldValues field values
367
   * @return feature results
368
   */
369
  public queryWithFieldValues(fieldValues: FieldValues): FeatureResultSet {
1✔
370
    return this.queryWithFieldValuesAndDistinctAndColumns(undefined, undefined, fieldValues);
×
371
  }
372

373
  /**
374
   * Query for features
375
   * @param distinct distinct rows
376
   * @param fieldValues field values
377
   * @return feature results
378
   */
379
  public queryWithFieldValuesAndDistinct(distinct: boolean, fieldValues: FieldValues): FeatureResultSet {
1✔
380
    return this.queryWithFieldValuesAndDistinctAndColumns(distinct, undefined, fieldValues);
×
381
  }
382

383
  /**
384
   * Query for features
385
   * @param columns columns
386
   * @param fieldValues field values
387
   * @return feature results
388
   */
389
  public queryWithFieldValuesAndColumns(columns: string[], fieldValues: FieldValues): FeatureResultSet {
1✔
390
    return this.queryWithFieldValuesAndDistinctAndColumns(undefined, columns, fieldValues);
×
391
  }
392

393
  /**
394
   * Query for features
395
   * @param distinct distinct rows
396
   * @param columns columns
397
   * @param fieldValues field values
398
   * @return feature results
399
   */
400
  public queryWithFieldValuesAndDistinctAndColumns(
1✔
401
    distinct: boolean,
402
    columns: string[],
403
    fieldValues: FieldValues,
404
  ): FeatureResultSet {
405
    const where: string = this.featureDao.buildWhereWithFields(fieldValues);
×
406
    const whereArgs: any[] = this.featureDao.buildWhereArgs(fieldValues);
×
407
    return this.featureDao.queryInWithDistinctAndColumns(distinct, columns, where, whereArgs);
×
408
  }
409

410
  /**
411
   * Count features
412
   * @param distinct distinct column values
413
   * @param column count column name
414
   * @param fieldValues field values
415
   * @return count
416
   */
417
  public countWithFieldValues(distinct = false, column: string, fieldValues: FieldValues): number {
1!
418
    const where: string = this.featureDao.buildWhereWithFields(fieldValues);
×
419
    const whereArgs: any[] = this.featureDao.buildWhereArgs(fieldValues);
×
420
    return this.featureDao.countColumn(distinct, column, where, whereArgs);
×
421
  }
422

423
  /**
424
   * Manually build the bounds of the feature table
425
   * @return bounding box
426
   */
427
  public getBoundingBox(): BoundingBox {
1✔
428
    let envelope = null;
×
429
    let offset = 0;
×
430
    let hasResults = true;
×
431
    const columns: string[] = [this.featureDao.getGeometryColumnName()];
×
432
    while (hasResults) {
×
433
      hasResults = false;
×
434
      const resultSet = this.featureDao.queryForChunkWithColumns(
×
435
        columns,
436
        undefined,
437
        undefined,
438
        undefined,
439
        undefined,
440
        undefined,
441
        this.chunkLimit,
442
        offset,
443
      );
444
      while (resultSet.moveToNext()) {
×
445
        hasResults = true;
×
446
        const featureRow = resultSet.getRow();
×
447
        const featureEnvelope = featureRow.getGeometryEnvelope();
×
448
        if (featureEnvelope != null) {
×
449
          if (envelope == null) {
×
450
            envelope = featureEnvelope;
×
451
          } else {
452
            envelope = envelope.union(featureEnvelope);
×
453
          }
454
        }
455
      }
456
      offset += this.chunkLimit;
×
457
    }
458
    let boundingBox = null;
×
459
    if (envelope != null) {
×
460
      boundingBox = new BoundingBox(envelope);
×
461
    }
462
    return boundingBox;
×
463
  }
464

465
  /**
466
   * Manually build the bounds of the feature table in the provided projection
467
   * @param projection desired projection
468
   * @return bounding box
469
   */
470
  public getBoundingBoxWithProjection(projection: Projection): BoundingBox {
1✔
471
    let boundingBox = this.getBoundingBox();
×
472
    if (boundingBox != null && projection != null) {
×
473
      const projectionTransform = GeometryTransform.create(this.featureDao.getProjection(), projection);
×
474
      boundingBox = boundingBox.transform(projectionTransform);
×
475
    }
476
    return boundingBox;
×
477
  }
478

479
  /**
480
   * Manually query for rows within the bounding box
481
   * @param boundingBox bounding box
482
   * @return results
483
   */
484
  public queryWithBoundingBox(boundingBox: BoundingBox): ManualFeatureQueryResults {
1✔
485
    return this.queryWithGeometryEnvelope(boundingBox.buildEnvelope());
×
486
  }
487

488
  /**
489
   * Manually query for rows within the bounding box
490
   * @param distinct distinct rows
491
   * @param boundingBox bounding box
492
   * @return results
493
   */
494
  public queryWithBoundingBoxAndDistinct(distinct: boolean, boundingBox: BoundingBox): ManualFeatureQueryResults {
1✔
495
    return this.queryWithGeometryEnvelopeAndDistinct(distinct, boundingBox.buildEnvelope());
×
496
  }
497

498
  /**
499
   * Manually query for rows within the bounding box
500
   * @param columns columns
501
   * @param boundingBox bounding box
502
   * @return results
503
   */
504
  public queryWithBoundingBoxAndColumns(columns: string[], boundingBox: BoundingBox): ManualFeatureQueryResults {
1✔
505
    return this.queryWithGeometryEnvelopeAndColumns(columns, boundingBox.buildEnvelope());
×
506
  }
507

508
  /**
509
   * Manually query for rows within the bounding box
510
   * @param distinct distinct rows
511
   * @param columns columns
512
   * @param boundingBox bounding box
513
   * @return results
514
   */
515
  public queryWithBoundingBoxAndDistinctAndColumns(
1✔
516
    distinct: boolean,
517
    columns: string[],
518
    boundingBox: BoundingBox,
519
  ): ManualFeatureQueryResults {
520
    return this.queryWithGeometryEnvelopeAndDistinctAndColumns(distinct, columns, boundingBox.buildEnvelope());
×
521
  }
522

523
  /**
524
   * Manually count the rows within the bounding box
525
   * @param boundingBox bounding box
526
   * @return count
527
   */
528
  public countWithBoundingBox(boundingBox: BoundingBox): number {
1✔
529
    return this.countWithGeometryEnvelope(boundingBox.buildEnvelope());
×
530
  }
531

532
  /**
533
   * Manually query for rows within the bounding box
534
   * @param boundingBox bounding box
535
   * @param fieldValues field values
536
   * @return results
537
   */
538
  public queryWithBoundingBoxAndFieldValues(
1✔
539
    boundingBox: BoundingBox,
540
    fieldValues: FieldValues,
541
  ): ManualFeatureQueryResults {
542
    return this.queryWithGeometryEnvelopeAndFieldValues(boundingBox.buildEnvelope(), fieldValues);
×
543
  }
544

545
  /**
546
   * Manually query for rows within the bounding box
547
   * @param distinct distinct rows
548
   * @param boundingBox bounding box
549
   * @param fieldValues field values
550
   * @return results
551
   */
552
  public queryWithBoundingBoxAndFieldValuesAndDistinct(
1✔
553
    distinct: boolean,
554
    boundingBox: BoundingBox,
555
    fieldValues: FieldValues,
556
  ): ManualFeatureQueryResults {
557
    return this.queryWithGeometryEnvelopeAndFieldValuesAndDistinct(distinct, boundingBox.buildEnvelope(), fieldValues);
×
558
  }
559

560
  /**
561
   * Manually query for rows within the bounding box
562
   * @param columns columns
563
   * @param boundingBox bounding box
564
   * @param fieldValues field values
565
   * @return results
566
   */
567
  public queryWithBoundingBoxAndFieldValuesAndColumns(
1✔
568
    columns: string[],
569
    boundingBox: BoundingBox,
570
    fieldValues: FieldValues,
571
  ): ManualFeatureQueryResults {
572
    return this.queryWithGeometryEnvelopeAndFieldValuesAndColumns(columns, boundingBox.buildEnvelope(), fieldValues);
×
573
  }
574

575
  /**
576
   * Manually query for rows within the bounding box
577
   * @param distinct distinct rows
578
   * @param columns columns
579
   * @param boundingBox bounding box
580
   * @param fieldValues field values
581
   * @return results
582
   */
583
  public queryWithBoundingBoxAndFieldValuesAndDistinctAndColumns(
1✔
584
    distinct: boolean,
585
    columns: string[],
586
    boundingBox: BoundingBox,
587
    fieldValues: FieldValues,
588
  ): ManualFeatureQueryResults {
589
    return this.queryWithGeometryEnvelopeAndFieldValuesAndDistinctAndColumns(
×
590
      distinct,
591
      columns,
592
      boundingBox.buildEnvelope(),
593
      fieldValues,
594
    );
595
  }
596

597
  /**
598
   * Manually count the rows within the bounding box
599
   * @param boundingBox bounding box
600
   * @param fieldValues field values
601
   * @return count
602
   */
603
  public countWithBoundingBoxAndFieldValues(boundingBox: BoundingBox, fieldValues: FieldValues): number {
1✔
604
    return this.countWithGeometryEnvelopeAndFieldValues(boundingBox.buildEnvelope(), fieldValues);
×
605
  }
606

607
  /**
608
   * Manually query for rows within the bounding box in the provided
609
   * projection
610
   * @param boundingBox bounding box
611
   * @param projection: Projection
612
   * @return results
613
   */
614
  public queryWithBoundingBoxAndProjection(
1✔
615
    boundingBox: BoundingBox,
616
    projection: Projection,
617
  ): ManualFeatureQueryResults {
618
    return this.queryWithBoundingBoxAndProjectionAndDistinctAndColumns(undefined, undefined, boundingBox, projection);
×
619
  }
620

621
  /**
622
   * Manually query for rows within the bounding box in the provided
623
   * projection
624
   * @param distinct distinct rows
625
   * @param boundingBox bounding box
626
   * @param projection: Projection
627
   * @return results
628
   */
629
  public queryWithBoundingBoxAndProjectionAndDistinct(
1✔
630
    distinct: boolean,
631
    boundingBox: BoundingBox,
632
    projection: Projection,
633
  ): ManualFeatureQueryResults {
634
    return this.queryWithBoundingBoxAndProjectionAndDistinctAndColumns(distinct, undefined, boundingBox, projection);
×
635
  }
636

637
  /**
638
   * Manually query for rows within the bounding box in the provided
639
   * projection
640
   * @param columns columns
641
   * @param boundingBox bounding box
642
   * @param projection: Projection
643
   * @return results
644
   */
645
  public queryWithBoundingBoxAndProjectionAndColumns(
1✔
646
    columns: string[],
647
    boundingBox: BoundingBox,
648
    projection: Projection,
649
  ): ManualFeatureQueryResults {
650
    return this.queryWithBoundingBoxAndProjectionAndDistinctAndColumns(undefined, columns, boundingBox, projection);
×
651
  }
652

653
  /**
654
   * Manually query for rows within the bounding box in the provided
655
   * projection
656
   * @param distinct distinct rows
657
   * @param columns columns
658
   * @param boundingBox bounding box
659
   * @param projection: Projection
660
   * @return results
661
   */
662
  public queryWithBoundingBoxAndProjectionAndDistinctAndColumns(
1✔
663
    distinct: boolean,
664
    columns: string[],
665
    boundingBox: BoundingBox,
666
    projection: Projection,
667
  ): ManualFeatureQueryResults {
668
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
669
    return this.queryWithBoundingBoxAndDistinctAndColumns(distinct, columns, featureBoundingBox);
×
670
  }
671

672
  /**
673
   * Manually count the rows within the bounding box in the provided projection
674
   * @param boundingBox bounding box
675
   * @param projection: Projection
676
   * @return count
677
   */
678
  public countWithBoundingBoxAndProjection(boundingBox: BoundingBox, projection: Projection): number {
1✔
679
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
680
    return this.countWithBoundingBox(featureBoundingBox);
×
681
  }
682

683
  /**
684
   * Manually query for rows within the bounding box in the provided
685
   * projection
686
   * @param boundingBox bounding box
687
   * @param projection: Projection
688
   * @param fieldValues field values
689
   * @return results
690
   */
691
  public queryWithBoundingBoxAndProjectionAndFieldValues(
1✔
692
    boundingBox: BoundingBox,
693
    projection: Projection,
694
    fieldValues: FieldValues,
695
  ): ManualFeatureQueryResults {
696
    return this.queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinctAndColumns(
×
697
      undefined,
698
      undefined,
699
      boundingBox,
700
      projection,
701
      fieldValues,
702
    );
703
  }
704

705
  /**
706
   * Manually query for rows within the bounding box in the provided
707
   * projection
708
   * @param distinct distinct rows
709
   * @param boundingBox bounding box
710
   * @param projection: Projection
711
   * @param fieldValues field values
712
   * @return results
713
   */
714
  public queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinct(
1✔
715
    distinct: boolean,
716
    boundingBox: BoundingBox,
717
    projection: Projection,
718
    fieldValues: FieldValues,
719
  ): ManualFeatureQueryResults {
720
    return this.queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinctAndColumns(
×
721
      distinct,
722
      undefined,
723
      boundingBox,
724
      projection,
725
      fieldValues,
726
    );
727
  }
728

729
  /**
730
   * Manually query for rows within the bounding box in the provided
731
   * projection
732
   * @param columns columns
733
   * @param boundingBox bounding box
734
   * @param projection: Projection
735
   * @param fieldValues field values
736
   * @return results
737
   */
738
  public queryWithBoundingBoxAndProjectionAndFieldValuesAndColumns(
1✔
739
    columns: string[],
740
    boundingBox: BoundingBox,
741
    projection: Projection,
742
    fieldValues: FieldValues,
743
  ): ManualFeatureQueryResults {
744
    return this.queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinctAndColumns(
×
745
      undefined,
746
      columns,
747
      boundingBox,
748
      projection,
749
      fieldValues,
750
    );
751
  }
752

753
  /**
754
   * Manually query for rows within the bounding box in the provided
755
   * projection
756
   * @param distinct distinct rows
757
   * @param columns columns
758
   * @param boundingBox bounding box
759
   * @param projection: Projection
760
   * @param fieldValues field values
761
   * @return results
762
   */
763
  public queryWithBoundingBoxAndProjectionAndFieldValuesAndDistinctAndColumns(
1✔
764
    distinct: boolean,
765
    columns: string[],
766
    boundingBox: BoundingBox,
767
    projection: Projection,
768
    fieldValues: FieldValues,
769
  ): ManualFeatureQueryResults {
770
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
771
    return this.queryWithBoundingBoxAndFieldValuesAndDistinctAndColumns(
×
772
      distinct,
773
      columns,
774
      featureBoundingBox,
775
      fieldValues,
776
    );
777
  }
778

779
  /**
780
   * Manually count the rows within the bounding box in the provided
781
   * projection
782
   * @param boundingBox bounding box
783
   * @param projection: Projection
784
   * @param fieldValues field values
785
   * @return count
786
   */
787
  public countWithBoundingBoxAndProjectionAndFieldValues(
1✔
788
    boundingBox: BoundingBox,
789
    projection: Projection,
790
    fieldValues: FieldValues,
791
  ): number {
792
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
793
    return this.countWithBoundingBoxAndFieldValues(featureBoundingBox, fieldValues);
×
794
  }
795

796
  /**
797
   * Manually query for rows within the bounding box in the provided
798
   * projection
799
   * @param boundingBox bounding box
800
   * @param projection: Projection
801
   * @param where where clause
802
   * @param whereArgs where arguments
803
   * @return results
804
   */
805
  public queryWhereWithBoundingBoxAndProjection(
1✔
806
    boundingBox: BoundingBox,
807
    projection: Projection,
808
    where: string,
809
    whereArgs: any[],
810
  ): ManualFeatureQueryResults {
811
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
812
    return this.queryWhereWithBoundingBox(featureBoundingBox, where, whereArgs);
×
813
  }
814

815
  /**
816
   * Manually query for rows within the bounding box in the provided
817
   * projection
818
   * @param distinct distinct rows
819
   * @param boundingBox bounding box
820
   * @param projection: Projection
821
   * @param where where clause
822
   * @param whereArgs where arguments
823
   * @return results
824
   */
825
  public queryWhereWithBoundingBoxAndProjectionAndDistinct(
1✔
826
    distinct: boolean,
827
    boundingBox: BoundingBox,
828
    projection: Projection,
829
    where: string,
830
    whereArgs: any[],
831
  ): ManualFeatureQueryResults {
832
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
833
    return this.queryWhereWithBoundingBoxAndDistinct(distinct, featureBoundingBox, where, whereArgs);
×
834
  }
835

836
  /**
837
   * Manually query for rows within the bounding box in the provided
838
   * projection
839
   * @param columns columns
840
   * @param boundingBox bounding box
841
   * @param projection: Projection
842
   * @param where where clause
843
   * @param whereArgs where arguments
844
   * @return results
845
   */
846
  public queryWhereWithBoundingBoxAndProjectionAndColumns(
1✔
847
    columns: string[],
848
    boundingBox: BoundingBox,
849
    projection: Projection,
850
    where: string,
851
    whereArgs: any[],
852
  ): ManualFeatureQueryResults {
853
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
854
    return this.queryWhereWithBoundingBoxAndColumns(columns, featureBoundingBox, where, whereArgs);
×
855
  }
856

857
  /**
858
   * Manually query for rows within the bounding box in the provided
859
   * projection
860
   * @param distinct distinct rows
861
   * @param columns columns
862
   * @param boundingBox bounding box
863
   * @param projection: Projection
864
   * @param where where clause
865
   * @param whereArgs where arguments
866
   * @return results
867
   */
868
  public queryWhereWithBoundingBoxAndProjectionAndDistinctAndColumns(
1✔
869
    distinct: boolean,
870
    columns: string[],
871
    boundingBox: BoundingBox,
872
    projection: Projection,
873
    where: string,
874
    whereArgs: any[],
875
  ): ManualFeatureQueryResults {
876
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
877
    return this.queryWhereWithBoundingBoxAndDistinctAndColumns(distinct, columns, featureBoundingBox, where, whereArgs);
×
878
  }
879

880
  /**
881
   * Manually count the rows within the bounding box in the provided
882
   * projection
883
   * @param boundingBox bounding box
884
   * @param projection: Projection
885
   * @param where where clause
886
   * @param whereArgs where arguments
887
   * @return count
888
   */
889
  public countWhereWithBoundingBoxAndProjection(
1✔
890
    boundingBox: BoundingBox,
891
    projection: Projection,
892
    where: string,
893
    whereArgs: any[],
894
  ): number {
895
    const featureBoundingBox = this.featureDao.projectBoundingBox(boundingBox, projection);
×
896
    return this.countWhereWithBoundingBox(featureBoundingBox, where, whereArgs);
×
897
  }
898

899
  /**
900
   * Manually query for rows within the geometry envelope
901
   * @param envelope geometry envelope
902
   * @return results
903
   */
904
  public queryWithGeometryEnvelope(envelope: GeometryEnvelope): ManualFeatureQueryResults {
1✔
905
    return this.queryWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY);
×
906
  }
907

908
  /**
909
   * Manually query for rows within the geometry envelope
910
   * @param envelope geometry envelope
911
   * @param distinct distinct rows
912
   * @return results
913
   */
914
  public queryWithGeometryEnvelopeAndDistinct(
1✔
915
    distinct: boolean,
916
    envelope: GeometryEnvelope,
917
  ): ManualFeatureQueryResults {
918
    return this.queryWithBoundsAndDistinct(distinct, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY);
×
919
  }
920

921
  /**
922
   * Manually query for rows within the geometry envelope
923
   * @param envelope geometry envelope
924
   * @param columns columns
925
   * @return results
926
   */
927
  public queryWithGeometryEnvelopeAndColumns(columns: string[], envelope: GeometryEnvelope): ManualFeatureQueryResults {
1✔
928
    return this.queryWithBoundsAndColumns(columns, envelope.minX, envelope.minY, envelope.maxX, envelope.maxY);
×
929
  }
930

931
  /**
932
   * Manually query for rows within the geometry envelope
933
   * @param envelope geometry envelope
934
   * @param distinct distinct rows
935
   * @param columns columns
936
   * @return results
937
   */
938
  public queryWithGeometryEnvelopeAndDistinctAndColumns(
1✔
939
    distinct: boolean,
940
    columns: string[],
941
    envelope: GeometryEnvelope,
942
  ): ManualFeatureQueryResults {
943
    return this.queryWithBoundsAndDistinctAndColumns(
×
944
      distinct,
945
      columns,
946
      envelope.minX,
947
      envelope.minY,
948
      envelope.maxX,
949
      envelope.maxY,
950
    );
951
  }
952

953
  /**
954
   * Manually count the rows within the geometry envelope
955
   * @param envelope geometry envelope
956
   * @param where where clause
957
   * @param whereArgs where args
958
   * @return count
959
   */
960
  public countWithGeometryEnvelope(envelope: GeometryEnvelope, where?: string, whereArgs?: any[]): number {
1✔
961
    return this.countWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
962
  }
963

964
  /**
965
   * Manually query for rows within the geometry envelope
966
   * @param envelope geometry envelope
967
   * @param fieldValues field values
968
   * @return results
969
   */
970
  public queryWithGeometryEnvelopeAndFieldValues(
1✔
971
    envelope: GeometryEnvelope,
972
    fieldValues: FieldValues,
973
  ): ManualFeatureQueryResults {
974
    return this.queryWithBoundsAndFieldValues(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, fieldValues);
×
975
  }
976

977
  /**
978
   * Manually query for rows within the geometry envelope
979
   * @param distinct distinct rows
980
   * @param envelope geometry envelope
981
   * @param fieldValues field values
982
   * @return results
983
   */
984
  public queryWithGeometryEnvelopeAndFieldValuesAndDistinct(
1✔
985
    distinct: boolean,
986
    envelope: GeometryEnvelope,
987
    fieldValues: FieldValues,
988
  ): ManualFeatureQueryResults {
989
    return this.queryWithBoundsAndFieldValuesAndDistinct(
×
990
      distinct,
991
      envelope.minX,
992
      envelope.minY,
993
      envelope.maxX,
994
      envelope.maxY,
995
      fieldValues,
996
    );
997
  }
998

999
  /**
1000
   * Manually query for rows within the geometry envelope
1001
   * @param columns columns
1002
   * @param envelope geometry envelope
1003
   * @param fieldValues field values
1004
   * @return results
1005
   */
1006
  public queryWithGeometryEnvelopeAndFieldValuesAndColumns(
1✔
1007
    columns: string[],
1008
    envelope: GeometryEnvelope,
1009
    fieldValues: FieldValues,
1010
  ): ManualFeatureQueryResults {
1011
    return this.queryWithBoundsAndFieldValuesAndColumns(
×
1012
      columns,
1013
      envelope.minX,
1014
      envelope.minY,
1015
      envelope.maxX,
1016
      envelope.maxY,
1017
      fieldValues,
1018
    );
1019
  }
1020

1021
  /**
1022
   * Manually query for rows within the geometry envelope
1023
   *
1024
   * @param distinct distinct rows
1025
   * @param columns columns
1026
   * @param envelope geometry envelope
1027
   * @param fieldValues field values
1028
   * @return results
1029
   */
1030
  public queryWithGeometryEnvelopeAndFieldValuesAndDistinctAndColumns(
1✔
1031
    distinct: boolean,
1032
    columns: string[],
1033
    envelope: GeometryEnvelope,
1034
    fieldValues: FieldValues,
1035
  ): ManualFeatureQueryResults {
1036
    return this.queryWithBoundsAndFieldValuesAndDistinctAndColumns(
×
1037
      distinct,
1038
      columns,
1039
      envelope.minX,
1040
      envelope.minY,
1041
      envelope.maxX,
1042
      envelope.maxY,
1043
      fieldValues,
1044
    );
1045
  }
1046

1047
  /**
1048
   * Manually count the rows within the geometry envelope
1049
   * @param envelope geometry envelope
1050
   * @param fieldValues field values
1051
   * @return count
1052
   */
1053
  public countWithGeometryEnvelopeAndFieldValues(envelope: GeometryEnvelope, fieldValues: FieldValues): number {
1✔
1054
    return this.countWithBoundsAndFieldValues(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, fieldValues);
×
1055
  }
1056

1057
  /**
1058
   * Manually query for rows within the bounding box
1059
   * @param boundingBox bounding box
1060
   * @param where where clause
1061
   * @param whereArgs where arguments
1062
   * @return results
1063
   */
1064
  public queryWhereWithBoundingBox(
1✔
1065
    boundingBox: BoundingBox,
1066
    where: string,
1067
    whereArgs: any[],
1068
  ): ManualFeatureQueryResults {
1069
    return this.queryWhereWithGeometryEnvelope(boundingBox.buildEnvelope(), where, whereArgs);
×
1070
  }
1071

1072
  /**
1073
   * Manually query for rows within the bounding box
1074
   * @param distinct distinct rows
1075
   * @param boundingBox bounding box
1076
   * @param where where clause
1077
   * @param whereArgs where arguments
1078
   * @return results
1079
   */
1080
  public queryWhereWithBoundingBoxAndDistinct(
1✔
1081
    distinct: boolean,
1082
    boundingBox: BoundingBox,
1083
    where: string,
1084
    whereArgs: any[],
1085
  ): ManualFeatureQueryResults {
1086
    return this.queryWhereWithGeometryEnvelopeAndDistinct(distinct, boundingBox.buildEnvelope(), where, whereArgs);
×
1087
  }
1088

1089
  /**
1090
   * Manually query for rows within the bounding box
1091
   * @param columns columns
1092
   * @param boundingBox bounding box
1093
   * @param where where clause
1094
   * @param whereArgs where arguments
1095
   * @return results
1096
   */
1097
  public queryWhereWithBoundingBoxAndColumns(
1✔
1098
    columns: string[],
1099
    boundingBox: BoundingBox,
1100
    where: string,
1101
    whereArgs: any[],
1102
  ): ManualFeatureQueryResults {
1103
    return this.queryWhereWithGeometryEnvelopeAndColumns(columns, boundingBox.buildEnvelope(), where, whereArgs);
×
1104
  }
1105

1106
  /**
1107
   * Manually query for rows within the bounding box
1108
   * @param distinct distinct rows
1109
   * @param columns columns
1110
   * @param boundingBox bounding box
1111
   * @param where where clause
1112
   * @param whereArgs where arguments
1113
   * @return results
1114
   */
1115
  public queryWhereWithBoundingBoxAndDistinctAndColumns(
1✔
1116
    distinct: boolean,
1117
    columns: string[],
1118
    boundingBox: BoundingBox,
1119
    where: string,
1120
    whereArgs: any[],
1121
  ): ManualFeatureQueryResults {
1122
    return this.queryWhereWithGeometryEnvelopeAndDistinctAndColumns(
×
1123
      distinct,
1124
      columns,
1125
      boundingBox.buildEnvelope(),
1126
      where,
1127
      whereArgs,
1128
    );
1129
  }
1130

1131
  /**
1132
   * Manually query for rows within the geometry envelope
1133
   * @param envelope geometry envelope
1134
   * @param where where clause
1135
   * @param whereArgs where arguments
1136
   * @return results
1137
   */
1138
  public queryWhereWithGeometryEnvelope(
1✔
1139
    envelope: GeometryEnvelope,
1140
    where: string,
1141
    whereArgs: any[],
1142
  ): ManualFeatureQueryResults {
1143
    return this.queryWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
1144
  }
1145

1146
  /**
1147
   * Manually query for rows within the geometry envelope
1148
   * @param distinct distinct rows
1149
   * @param envelope geometry envelope
1150
   * @param where where clause
1151
   * @param whereArgs where arguments
1152
   * @return results
1153
   */
1154
  public queryWhereWithGeometryEnvelopeAndDistinct(
1✔
1155
    distinct: boolean,
1156
    envelope: GeometryEnvelope,
1157
    where: string,
1158
    whereArgs: any[],
1159
  ): ManualFeatureQueryResults {
1160
    return this.queryWithBoundsAndDistinct(
×
1161
      distinct,
1162
      envelope.minX,
1163
      envelope.minY,
1164
      envelope.maxX,
1165
      envelope.maxY,
1166
      where,
1167
      whereArgs,
1168
    );
1169
  }
1170

1171
  /**
1172
   * Manually query for rows within the geometry envelope
1173
   * @param columns columns
1174
   * @param envelope geometry envelope
1175
   * @param where where clause
1176
   * @param whereArgs where arguments
1177
   * @return results
1178
   */
1179
  public queryWhereWithGeometryEnvelopeAndColumns(
1✔
1180
    columns: string[],
1181
    envelope: GeometryEnvelope,
1182
    where: string,
1183
    whereArgs: any[],
1184
  ): ManualFeatureQueryResults {
1185
    return this.queryWithBoundsAndColumns(
×
1186
      columns,
1187
      envelope.minX,
1188
      envelope.minY,
1189
      envelope.maxX,
1190
      envelope.maxY,
1191
      where,
1192
      whereArgs,
1193
    );
1194
  }
1195

1196
  /**
1197
   * Manually query for rows within the geometry envelope
1198
   * @param distinct distinct rows
1199
   * @param columns columns
1200
   * @param envelope geometry envelope
1201
   * @param where where clause
1202
   * @param whereArgs where arguments
1203
   * @return results
1204
   */
1205
  public queryWhereWithGeometryEnvelopeAndDistinctAndColumns(
1✔
1206
    distinct: boolean,
1207
    columns: string[],
1208
    envelope: GeometryEnvelope,
1209
    where: string,
1210
    whereArgs: any[],
1211
  ): ManualFeatureQueryResults {
1212
    return this.queryWithBoundsAndDistinctAndColumns(
×
1213
      distinct,
1214
      columns,
1215
      envelope.minX,
1216
      envelope.minY,
1217
      envelope.maxX,
1218
      envelope.maxY,
1219
      where,
1220
      whereArgs,
1221
    );
1222
  }
1223

1224
  /**
1225
   * Manually count the rows within the bounding box
1226
   * @param boundingBox bounding box
1227
   * @param where where clause
1228
   * @param whereArgs where arguments
1229
   * @return count
1230
   */
1231
  public countWhereWithBoundingBox(boundingBox: BoundingBox, where: string, whereArgs: any[]): number {
1✔
1232
    return this.countWhereWithGeometryEnvelope(boundingBox.buildEnvelope(), where, whereArgs);
×
1233
  }
1234

1235
  /**
1236
   * Manually count the rows within the geometry envelope
1237
   *
1238
   * @param envelope geometry envelope
1239
   * @param where where clause
1240
   * @param whereArgs where arguments
1241
   * @return count
1242
   */
1243
  public countWhereWithGeometryEnvelope(envelope: GeometryEnvelope, where: string, whereArgs: any[]): number {
1✔
1244
    return this.countWithBounds(envelope.minX, envelope.minY, envelope.maxX, envelope.maxY, where, whereArgs);
×
1245
  }
1246

1247
  /**
1248
   * Manually query for rows within the bounds
1249
   * @param distinct distinct rows
1250
   * @param columns columns
1251
   * @param minX min x
1252
   * @param minY min y
1253
   * @param maxX max x
1254
   * @param maxY max y
1255
   * @return results
1256
   */
1257
  public queryWithinBounds(minX: number, minY: number, maxX: number, maxY: number): ManualFeatureQueryResults {
1✔
1258
    return this.queryWithBounds(minX, minY, maxX, maxY);
×
1259
  }
1260

1261
  /**
1262
   * Manually query for rows within the bounds
1263
   * @param distinct distinct rows
1264
   * @param minX min x
1265
   * @param minY min y
1266
   * @param maxX max x
1267
   * @param maxY max y
1268
   * @return results
1269
   */
1270
  public queryWithinBoundsWithDistinct(
1✔
1271
    distinct = false,
×
1272
    minX: number,
1273
    minY: number,
1274
    maxX: number,
1275
    maxY: number,
1276
  ): ManualFeatureQueryResults {
1277
    return this.queryWithBoundsAndDistinct(distinct, minX, minY, maxX, maxY);
×
1278
  }
1279

1280
  /**
1281
   * Manually query for rows within the bounds
1282
   * @param columns columns
1283
   * @param minX min x
1284
   * @param minY min y
1285
   * @param maxX max x
1286
   * @param maxY max y
1287
   * @return results
1288
   */
1289
  public queryWithinBoundWithColumns(
1✔
1290
    columns: string[] = [],
×
1291
    minX: number,
1292
    minY: number,
1293
    maxX: number,
1294
    maxY: number,
1295
  ): ManualFeatureQueryResults {
1296
    return this.queryWithBoundsAndColumns(columns, minX, minY, maxX, maxY);
×
1297
  }
1298

1299
  /**
1300
   * Manually query for rows within the bounds
1301
   * @param distinct distinct rows
1302
   * @param columns columns
1303
   * @param minX min x
1304
   * @param minY min y
1305
   * @param maxX max x
1306
   * @param maxY max y
1307
   * @return results
1308
   */
1309
  public queryWithinBoundsWithDistinctAndColumns(
1✔
1310
    distinct = false,
×
1311
    columns: string[] = [],
×
1312
    minX: number,
1313
    minY: number,
1314
    maxX: number,
1315
    maxY: number,
1316
  ): ManualFeatureQueryResults {
1317
    return this.queryWithBoundsAndDistinctAndColumns(distinct, columns, minX, minY, maxX, maxY);
×
1318
  }
1319

1320
  /**
1321
   * Manually count the rows within the bounds
1322
   * @param minX min x
1323
   * @param minY min y
1324
   * @param maxX max x
1325
   * @param maxY max y
1326
   * @return count
1327
   */
1328
  public countWithinBounds(minX: number, minY: number, maxX: number, maxY: number): number {
1✔
1329
    return this.queryWithinBounds(minX, minY, maxX, maxY).count();
×
1330
  }
1331

1332
  /**
1333
   * Manually query for rows within the bounds
1334
   * @param minX min x
1335
   * @param minY min y
1336
   * @param maxX max x
1337
   * @param maxY max y
1338
   * @param fieldValues field values
1339
   * @return results
1340
   */
1341
  public queryWithBoundsAndFieldValues(
1✔
1342
    minX: number,
1343
    minY: number,
1344
    maxX: number,
1345
    maxY: number,
1346
    fieldValues: FieldValues,
1347
  ): ManualFeatureQueryResults {
1348
    return this.queryWithBoundsAndFieldValuesAndDistinctAndColumns(
×
1349
      undefined,
1350
      undefined,
1351
      minX,
1352
      minY,
1353
      maxX,
1354
      maxY,
1355
      fieldValues,
1356
    );
1357
  }
1358

1359
  /**
1360
   * Manually query for rows within the bounds
1361
   * @param distinct distinct rows
1362
   * @param minX min x
1363
   * @param minY min y
1364
   * @param maxX max x
1365
   * @param maxY max y
1366
   * @param fieldValues field values
1367
   * @return results
1368
   */
1369
  public queryWithBoundsAndFieldValuesAndDistinct(
1✔
1370
    distinct: boolean,
1371
    minX: number,
1372
    minY: number,
1373
    maxX: number,
1374
    maxY: number,
1375
    fieldValues: FieldValues,
1376
  ): ManualFeatureQueryResults {
1377
    return this.queryWithBoundsAndFieldValuesAndDistinctAndColumns(
×
1378
      distinct,
1379
      undefined,
1380
      minX,
1381
      minY,
1382
      maxX,
1383
      maxY,
1384
      fieldValues,
1385
    );
1386
  }
1387

1388
  /**
1389
   * Manually query for rows within the bounds
1390
   * @param columns columns
1391
   * @param minX min x
1392
   * @param minY min y
1393
   * @param maxX max x
1394
   * @param maxY max y
1395
   * @param fieldValues field values
1396
   * @return results
1397
   */
1398
  public queryWithBoundsAndFieldValuesAndColumns(
1✔
1399
    columns: string[],
1400
    minX: number,
1401
    minY: number,
1402
    maxX: number,
1403
    maxY: number,
1404
    fieldValues: FieldValues,
1405
  ): ManualFeatureQueryResults {
1406
    return this.queryWithBoundsAndFieldValuesAndDistinctAndColumns(
×
1407
      undefined,
1408
      columns,
1409
      minX,
1410
      minY,
1411
      maxX,
1412
      maxY,
1413
      fieldValues,
1414
    );
1415
  }
1416

1417
  /**
1418
   * Manually query for rows within the bounds
1419
   * @param distinct distinct rows
1420
   * @param columns columns
1421
   * @param minX min x
1422
   * @param minY min y
1423
   * @param maxX max x
1424
   * @param maxY max y
1425
   * @param fieldValues field values
1426
   * @return results
1427
   */
1428
  public queryWithBoundsAndFieldValuesAndDistinctAndColumns(
1✔
1429
    distinct: boolean,
1430
    columns: string[],
1431
    minX: number,
1432
    minY: number,
1433
    maxX: number,
1434
    maxY: number,
1435
    fieldValues: FieldValues,
1436
  ): ManualFeatureQueryResults {
1437
    const where = this.featureDao.buildWhereWithFields(fieldValues);
×
1438
    const whereArgs = this.featureDao.buildWhereArgsWithValues(fieldValues);
×
1439
    return this.queryWithBoundsAndDistinctAndColumns(distinct, columns, minX, minY, maxX, maxY, where, whereArgs);
×
1440
  }
1441

1442
  /**
1443
   * Manually count the rows within the bounds
1444
   * @param minX min x
1445
   * @param minY min y
1446
   * @param maxX max x
1447
   * @param maxY max y
1448
   * @param fieldValues field values
1449
   * @return count
1450
   */
1451
  public countWithBoundsAndFieldValues(
1✔
1452
    minX: number,
1453
    minY: number,
1454
    maxX: number,
1455
    maxY: number,
1456
    fieldValues: FieldValues,
1457
  ): number {
1458
    const where = this.featureDao.buildWhereWithFields(fieldValues);
×
1459
    const whereArgs = this.featureDao.buildWhereArgsWithValues(fieldValues);
×
1460
    return this.countWithBounds(minX, minY, maxX, maxY, where, whereArgs);
×
1461
  }
1462

1463
  /**
1464
   * Manually query for rows within the bounds
1465
   * @param minX min x
1466
   * @param minY min y
1467
   * @param maxX max x
1468
   * @param maxY max y
1469
   * @param where where clause
1470
   * @param whereArgs where args
1471
   * @return results
1472
   */
1473
  public queryWithBounds(
1✔
1474
    minX: number,
1475
    minY: number,
1476
    maxX: number,
1477
    maxY: number,
1478
    where: string = undefined,
×
1479
    whereArgs: any[] = undefined,
×
1480
  ): ManualFeatureQueryResults {
1481
    return this.queryWithBoundsAndDistinctAndColumns(undefined, undefined, minX, minY, maxX, maxY, where, whereArgs);
×
1482
  }
1483

1484
  /**
1485
   * Manually query for rows within the bounds
1486
   * @param distinct distinct rows
1487
   * @param minX min x
1488
   * @param minY min y
1489
   * @param maxX max x
1490
   * @param maxY max y
1491
   * @param where where clause
1492
   * @param whereArgs where args
1493
   * @return results
1494
   */
1495
  public queryWithBoundsAndDistinct(
1✔
1496
    distinct: boolean,
1497
    minX: number,
1498
    minY: number,
1499
    maxX: number,
1500
    maxY: number,
1501
    where: string = undefined,
×
1502
    whereArgs: any[] = undefined,
×
1503
  ): ManualFeatureQueryResults {
1504
    return this.queryWithBoundsAndDistinctAndColumns(distinct, undefined, minX, minY, maxX, maxY, where, whereArgs);
×
1505
  }
1506

1507
  /**
1508
   * Manually query for rows within the bounds
1509
   * @param columns columns
1510
   * @param minX min x
1511
   * @param minY min y
1512
   * @param maxX max x
1513
   * @param maxY max y
1514
   * @param where where clause
1515
   * @param whereArgs where args
1516
   * @return results
1517
   */
1518
  public queryWithBoundsAndColumns(
1✔
1519
    columns: string[],
1520
    minX: number,
1521
    minY: number,
1522
    maxX: number,
1523
    maxY: number,
1524
    where: string = undefined,
×
1525
    whereArgs: any[] = undefined,
×
1526
  ): ManualFeatureQueryResults {
1527
    return this.queryWithBoundsAndDistinctAndColumns(undefined, columns, minX, minY, maxX, maxY, where, whereArgs);
×
1528
  }
1529

1530
  /**
1531
   * Manually query for rows within the bounds
1532
   * @param distinct distinct rows
1533
   * @param columns columns
1534
   * @param minX min x
1535
   * @param minY min y
1536
   * @param maxX max x
1537
   * @param maxY max y
1538
   * @param where where clause
1539
   * @param whereArgs where args
1540
   * @return results
1541
   */
1542
  public queryWithBoundsAndDistinctAndColumns(
1✔
1543
    distinct: boolean,
1544
    columns: string[],
1545
    minX: number,
1546
    minY: number,
1547
    maxX: number,
1548
    maxY: number,
1549
    where: string = undefined,
×
1550
    whereArgs: any[] = undefined,
×
1551
  ): ManualFeatureQueryResults {
1552
    const featureIds = [];
×
1553

1554
    let offset = 0;
×
1555
    let hasResults = true;
×
1556

1557
    minX -= this.tolerance;
×
1558
    maxX += this.tolerance;
×
1559
    minY -= this.tolerance;
×
1560
    maxY += this.tolerance;
×
1561

1562
    const queryColumns = this.featureDao.getIdAndGeometryColumnNames();
×
1563

1564
    while (hasResults) {
×
1565
      hasResults = false;
×
1566

1567
      const resultSet = this.featureDao.queryForChunkWithDistinctAndColumns(
×
1568
        distinct,
1569
        queryColumns,
1570
        where,
1571
        whereArgs,
1572
        undefined,
1573
        undefined,
1574
        undefined,
1575
        this.chunkLimit,
1576
        offset,
1577
      );
1578

1579
      while (resultSet.moveToNext()) {
×
1580
        hasResults = true;
×
1581

1582
        const featureRow = resultSet.getRow();
×
1583
        const envelope = featureRow.getGeometryEnvelope();
×
1584
        if (envelope != null) {
×
1585
          const minXMax = Math.max(minX, envelope.minX);
×
1586
          const maxXMin = Math.min(maxX, envelope.maxX);
×
1587
          const minYMax = Math.max(minY, envelope.minY);
×
1588
          const maxYMin = Math.min(maxY, envelope.maxY);
×
1589

1590
          if (minXMax <= maxXMin && minYMax <= maxYMin) {
×
1591
            featureIds.push(featureRow.getId());
×
1592
          }
1593
        }
1594
      }
1595
      offset += this.chunkLimit;
×
1596
    }
1597

1598
    return new ManualFeatureQueryResults(this.featureDao, featureIds, columns);
×
1599
  }
1600

1601
  /**
1602
   * Manually count the rows within the bounds
1603
   * @param minX min x
1604
   * @param minY min y
1605
   * @param maxX max x
1606
   * @param maxY max y
1607
   * @param where where clause
1608
   * @param whereArgs where args
1609
   * @return count
1610
   */
1611
  public countWithBounds(
1✔
1612
    minX: number,
1613
    minY: number,
1614
    maxX: number,
1615
    maxY: number,
1616
    where?: string,
1617
    whereArgs?: any[],
1618
  ): number {
1619
    return this.queryWithBounds(minX, minY, maxX, maxY, where, whereArgs).count();
×
1620
  }
1621

1622
  /**
1623
   * Query for features, starting at the offset and returning no more than the
1624
   * limit
1625
   * @param fieldValues field values
1626
   * @param orderBy order by
1627
   * @param limit chunk limit
1628
   * @param offset chunk query offset
1629
   * @return feature results
1630
   */
1631
  public queryForChunkWithFieldValues(
1✔
1632
    fieldValues: FieldValues,
1633
    orderBy: string,
1634
    limit: number,
1635
    offset: number,
1636
  ): FeatureResultSet {
1637
    return this.queryForChunkWithFieldValuesAndDistinctAndColumns(
×
1638
      undefined,
1639
      undefined,
1640
      fieldValues,
1641
      orderBy,
1642
      limit,
1643
      offset,
1644
    );
1645
  }
1646

1647
  /**
1648
   * Query for features, starting at the offset and returning no more than the
1649
   * limit
1650
   * @param distinct distinct rows
1651
   * @param fieldValues field values
1652
   * @param orderBy order by
1653
   * @param limit chunk limit
1654
   * @param offset chunk query offset
1655
   * @return feature results
1656
   */
1657
  public queryForChunkWithFieldValuesAndDistinct(
1✔
1658
    distinct: boolean,
1659
    fieldValues: FieldValues,
1660
    orderBy: string,
1661
    limit: number,
1662
    offset: number,
1663
  ): FeatureResultSet {
1664
    return this.queryForChunkWithFieldValuesAndDistinctAndColumns(
×
1665
      distinct,
1666
      undefined,
1667
      fieldValues,
1668
      orderBy,
1669
      limit,
1670
      offset,
1671
    );
1672
  }
1673

1674
  /**
1675
   * Query for features, starting at the offset and returning no more than the
1676
   * limit
1677
   * @param columns columns
1678
   * @param fieldValues field values
1679
   * @param orderBy order by
1680
   * @param limit chunk limit
1681
   * @param offset chunk query offset
1682
   * @return feature results
1683
   */
1684
  public queryForChunkWithFieldValuesAndColumns(
1✔
1685
    columns: string[],
1686
    fieldValues: FieldValues,
1687
    orderBy: string,
1688
    limit: number,
1689
    offset: number,
1690
  ): FeatureResultSet {
1691
    return this.queryForChunkWithFieldValuesAndDistinctAndColumns(
×
1692
      undefined,
1693
      columns,
1694
      fieldValues,
1695
      orderBy,
1696
      limit,
1697
      offset,
1698
    );
1699
  }
1700

1701
  /**
1702
   * Query for features, starting at the offset and returning no more than the
1703
   * limit
1704
   * @param distinct distinct rows
1705
   * @param columns columns
1706
   * @param fieldValues field values
1707
   * @param orderBy order by
1708
   * @param limit chunk limit
1709
   * @param offset chunk query offset
1710
   * @return feature results
1711
   */
1712
  public queryForChunkWithFieldValuesAndDistinctAndColumns(
1✔
1713
    distinct: boolean,
1714
    columns: string[],
1715
    fieldValues: FieldValues,
1716
    orderBy: string,
1717
    limit: number,
1718
    offset: number,
1719
  ): FeatureResultSet {
1720
    const where = this.featureDao.buildWhereWithFields(fieldValues);
×
1721
    const whereArgs = this.featureDao.buildWhereArgsWithValues(fieldValues);
×
1722
    return this.featureDao.queryForChunkWithDistinctAndColumns(
×
1723
      distinct,
1724
      columns,
1725
      where,
1726
      whereArgs,
1727
      undefined,
1728
      undefined,
1729
      orderBy,
1730
      limit,
1731
      offset,
1732
    );
1733
  }
1734

1735
  /**
1736
   * Query for features, starting at the offset and returning no more than the limit
1737
   * @param where where clause
1738
   * @param whereArgs where arguments
1739
   * @param orderBy order by
1740
   * @param limit chunk limit
1741
   * @param offset chunk query offset
1742
   * @return feature results
1743
   */
1744
  public queryForChunk(
1✔
1745
    where: string,
1746
    whereArgs: any[],
1747
    orderBy: string,
1748
    limit: number,
1749
    offset: number,
1750
  ): FeatureResultSet {
1751
    return this.featureDao.queryForChunk(where, whereArgs, undefined, undefined, orderBy, limit, offset);
×
1752
  }
1753

1754
  /**
1755
   * Query for features, starting at the offset and returning no more than the limit
1756
   * @param distinct distinct rows
1757
   * @param where where clause
1758
   * @param whereArgs where arguments
1759
   * @param orderBy order by
1760
   * @param limit chunk limit
1761
   * @param offset chunk query offset
1762
   * @return feature results
1763
   */
1764
  public queryForChunkWithDistinct(
1✔
1765
    distinct: boolean,
1766
    where: string,
1767
    whereArgs: any[],
1768
    orderBy: string,
1769
    limit: number,
1770
    offset: number,
1771
  ): FeatureResultSet {
1772
    return this.featureDao.queryForChunkWithDistinct(
×
1773
      distinct,
1774
      where,
1775
      whereArgs,
1776
      undefined,
1777
      undefined,
1778
      orderBy,
1779
      limit,
1780
      offset,
1781
    );
1782
  }
1783

1784
  /**
1785
   * Query for features, starting at the offset and returning no more than the limit
1786
   * @param columns columns
1787
   * @param where where clause
1788
   * @param whereArgs where arguments
1789
   * @param orderBy order by
1790
   * @param limit chunk limit
1791
   * @param offset chunk query offset
1792
   * @return feature results
1793
   */
1794
  public queryForChunkWithColumns(
1✔
1795
    columns: string[],
1796
    where: string,
1797
    whereArgs: any[],
1798
    orderBy: string,
1799
    limit: number,
1800
    offset: number,
1801
  ): FeatureResultSet {
1802
    return this.featureDao.queryForChunkWithColumns(
×
1803
      columns,
1804
      where,
1805
      whereArgs,
1806
      undefined,
1807
      undefined,
1808
      orderBy,
1809
      limit,
1810
      offset,
1811
    );
1812
  }
1813

1814
  /**
1815
   * Query for features, starting at the offset and returning no more than the limit
1816
   * @param distinct distinct rows
1817
   * @param columns columns
1818
   * @param where where clause
1819
   * @param whereArgs where arguments
1820
   * @param orderBy order by
1821
   * @param limit chunk limit
1822
   * @param offset chunk query offset
1823
   * @return feature results
1824
   */
1825
  public queryForChunkWithDistinctAndColumns(
1✔
1826
    distinct: boolean,
1827
    columns: string[],
1828
    where: string,
1829
    whereArgs: any[],
1830
    orderBy: string,
1831
    limit: number,
1832
    offset: number,
1833
  ): FeatureResultSet {
1834
    return this.featureDao.queryForChunkWithDistinctAndColumns(
×
1835
      distinct,
1836
      columns,
1837
      where,
1838
      whereArgs,
1839
      undefined,
1840
      undefined,
1841
      orderBy,
1842
      limit,
1843
      offset,
1844
    );
1845
  }
1846

1847
  /**
1848
   * Manually query for rows within the geometry envelope, starting at the
1849
   * offset and returning no more than the limit
1850
   * WARNING: This method must iterate from the 0 offset each time, is
1851
   * extremely inefficient, and not recommended for use
1852
   * @param envelope geometry envelope
1853
   * @param where where clause
1854
   * @param whereArgs where arguments
1855
   * @param orderBy order by
1856
   * @param limit chunk limit
1857
   * @param offset chunk query offset
1858
   * @return results
1859
   */
1860
  public queryForChunkWithGeometryEnvelope(
1✔
1861
    envelope: GeometryEnvelope,
1862
    where: string,
1863
    whereArgs: any[],
1864
    orderBy: string,
1865
    limit: number,
1866
    offset: number,
1867
  ): ManualFeatureQueryResults {
1868
    return this.queryForChunkWithBounds(
×
1869
      envelope.minX,
1870
      envelope.minY,
1871
      envelope.maxX,
1872
      envelope.maxY,
1873
      where,
1874
      whereArgs,
1875
      orderBy,
1876
      limit,
1877
      offset,
1878
    );
1879
  }
1880

1881
  /**
1882
   * Manually query for rows within the geometry envelope, starting at the
1883
   * offset and returning no more than the limit
1884
   * WARNING: This method must iterate from the 0 offset each time, is
1885
   * extremely inefficient, and not recommended for use
1886
   * @param distinct distinct rows
1887
   * @param envelope geometry envelope
1888
   * @param where where clause
1889
   * @param whereArgs where arguments
1890
   * @param orderBy order by
1891
   * @param limit chunk limit
1892
   * @param offset chunk query offset
1893
   * @return results
1894
   */
1895
  public queryForChunkWithGeometryEnvelopeAndDistinct(
1✔
1896
    distinct: boolean,
1897
    envelope: GeometryEnvelope,
1898
    where: string,
1899
    whereArgs: any[],
1900
    orderBy: string,
1901
    limit: number,
1902
    offset: number,
1903
  ): ManualFeatureQueryResults {
1904
    return this.queryForChunkWithBoundsAndDistinct(
×
1905
      distinct,
1906
      envelope.minX,
1907
      envelope.minY,
1908
      envelope.maxX,
1909
      envelope.maxY,
1910
      where,
1911
      whereArgs,
1912
      orderBy,
1913
      limit,
1914
      offset,
1915
    );
1916
  }
1917

1918
  /**
1919
   * Manually query for rows within the geometry envelope, starting at the
1920
   * offset and returning no more than the limit
1921
   * WARNING: This method must iterate from the 0 offset each time, is
1922
   * extremely inefficient, and not recommended for use
1923
   * @param columns columns
1924
   * @param envelope geometry envelope
1925
   * @param where where clause
1926
   * @param whereArgs where arguments
1927
   * @param orderBy order by
1928
   * @param limit chunk limit
1929
   * @param offset chunk query offset
1930
   * @return results
1931
   */
1932
  public queryForChunkWithGeometryEnvelopeAndColumns(
1✔
1933
    columns: string[],
1934
    envelope: GeometryEnvelope,
1935
    where: string,
1936
    whereArgs: any[],
1937
    orderBy: string,
1938
    limit: number,
1939
    offset: number,
1940
  ): ManualFeatureQueryResults {
1941
    return this.queryForChunkWithBoundsAndColumns(
×
1942
      columns,
1943
      envelope.minX,
1944
      envelope.minY,
1945
      envelope.maxX,
1946
      envelope.maxY,
1947
      where,
1948
      whereArgs,
1949
      orderBy,
1950
      limit,
1951
      offset,
1952
    );
1953
  }
1954

1955
  /**
1956
   * Manually query for rows within the geometry envelope, starting at the
1957
   * offset and returning no more than the limit
1958
   * WARNING: This method must iterate from the 0 offset each time, is
1959
   * extremely inefficient, and not recommended for use
1960
   * @param distinct distinct rows
1961
   * @param columns columns
1962
   * @param envelope geometry envelope
1963
   * @param where where clause
1964
   * @param whereArgs where arguments
1965
   * @param orderBy order by
1966
   * @param limit chunk limit
1967
   * @param offset chunk query offset
1968
   * @return results
1969
   */
1970
  public queryForChunkWithGeometryEnvelopeAndDistinctAndColumns(
1✔
1971
    distinct: boolean,
1972
    columns: string[],
1973
    envelope: GeometryEnvelope,
1974
    where: string,
1975
    whereArgs: any[],
1976
    orderBy: string,
1977
    limit: number,
1978
    offset: number,
1979
  ): ManualFeatureQueryResults {
1980
    return this.queryForChunkWithBoundsAndDistinctAndColumns(
×
1981
      distinct,
1982
      columns,
1983
      envelope.minX,
1984
      envelope.minY,
1985
      envelope.maxX,
1986
      envelope.maxY,
1987
      where,
1988
      whereArgs,
1989
      orderBy,
1990
      limit,
1991
      offset,
1992
    );
1993
  }
1994

1995
  /**
1996
   * Manually query for rows within the bounds, starting at the offset and
1997
   * returning no more than the limit
1998
   * WARNING: This method must iterate from the 0 offset each time, is
1999
   * extremely inefficient, and not recommended for use
2000
   * @param minX min x
2001
   * @param minY min y
2002
   * @param maxX max x
2003
   * @param maxY max y
2004
   * @param where where clause
2005
   * @param whereArgs where args
2006
   * @param orderBy order by
2007
   * @param limit chunk limit
2008
   * @param offset chunk query offset
2009
   * @return results
2010
   */
2011
  public queryForChunkWithBounds(
1✔
2012
    minX: number,
2013
    minY: number,
2014
    maxX: number,
2015
    maxY: number,
2016
    where: string,
2017
    whereArgs: any[],
2018
    orderBy: string,
2019
    limit: number,
2020
    offset: number,
2021
  ): ManualFeatureQueryResults {
2022
    return this.queryForChunkWithBoundsAndDistinctAndColumns(
×
2023
      undefined,
2024
      undefined,
2025
      minX,
2026
      minY,
2027
      maxX,
2028
      maxY,
2029
      where,
2030
      whereArgs,
2031
      orderBy,
2032
      limit,
2033
      offset,
2034
    );
2035
  }
2036

2037
  /**
2038
   * Manually query for rows within the bounds, starting at the offset and
2039
   * returning no more than the limit
2040
   * WARNING: This method must iterate from the 0 offset each time, is
2041
   * extremely inefficient, and not recommended for use
2042
   * @param distinct distinct rows
2043
   * @param minX min x
2044
   * @param minY min y
2045
   * @param maxX max x
2046
   * @param maxY max y
2047
   * @param where where clause
2048
   * @param whereArgs where args
2049
   * @param orderBy order by
2050
   * @param limit chunk limit
2051
   * @param offset chunk query offset
2052
   * @return results
2053
   */
2054
  public queryForChunkWithBoundsAndDistinct(
1✔
2055
    distinct: boolean,
2056
    minX: number,
2057
    minY: number,
2058
    maxX: number,
2059
    maxY: number,
2060
    where: string,
2061
    whereArgs: any[],
2062
    orderBy: string,
2063
    limit: number,
2064
    offset: number,
2065
  ): ManualFeatureQueryResults {
2066
    return this.queryForChunkWithBoundsAndDistinctAndColumns(
×
2067
      distinct,
2068
      undefined,
2069
      minX,
2070
      minY,
2071
      maxX,
2072
      maxY,
2073
      where,
2074
      whereArgs,
2075
      orderBy,
2076
      limit,
2077
      offset,
2078
    );
2079
  }
2080

2081
  /**
2082
   * Manually query for rows within the bounds, starting at the offset and
2083
   * returning no more than the limit
2084
   * WARNING: This method must iterate from the 0 offset each time, is
2085
   * extremely inefficient, and not recommended for use
2086
   * @param columns columns
2087
   * @param minX min x
2088
   * @param minY min y
2089
   * @param maxX max x
2090
   * @param maxY max y
2091
   * @param where where clause
2092
   * @param whereArgs where args
2093
   * @param orderBy order by
2094
   * @param limit chunk limit
2095
   * @param offset chunk query offset
2096
   * @return results
2097
   */
2098
  public queryForChunkWithBoundsAndColumns(
1✔
2099
    columns: string[],
2100
    minX: number,
2101
    minY: number,
2102
    maxX: number,
2103
    maxY: number,
2104
    where: string,
2105
    whereArgs: any[],
2106
    orderBy: string,
2107
    limit: number,
2108
    offset: number,
2109
  ): ManualFeatureQueryResults {
2110
    return this.queryForChunkWithBoundsAndDistinctAndColumns(
×
2111
      undefined,
2112
      columns,
2113
      minX,
2114
      minY,
2115
      maxX,
2116
      maxY,
2117
      where,
2118
      whereArgs,
2119
      orderBy,
2120
      limit,
2121
      offset,
2122
    );
2123
  }
2124

2125
  /**
2126
   * Manually query for rows within the bounds, starting at the offset and
2127
   * returning no more than the limit
2128
   * WARNING: This method must iterate from the 0 offset each time, is
2129
   * extremely inefficient, and not recommended for use
2130
   * @param distinct distinct rows
2131
   * @param columns columns
2132
   * @param minX min x
2133
   * @param minY min y
2134
   * @param maxX max x
2135
   * @param maxY max y
2136
   * @param where where clause
2137
   * @param whereArgs where args
2138
   * @param orderBy order by
2139
   * @param limit chunk limit
2140
   * @param offset chunk query offset
2141
   * @return results
2142
   */
2143
  public queryForChunkWithBoundsAndDistinctAndColumns(
1✔
2144
    distinct: boolean,
2145
    columns: string[],
2146
    minX: number,
2147
    minY: number,
2148
    maxX: number,
2149
    maxY: number,
2150
    where: string,
2151
    whereArgs: any[],
2152
    orderBy: string,
2153
    limit: number,
2154
    offset: number,
2155
  ): ManualFeatureQueryResults {
2156
    let index = 0;
×
2157
    const featureIds = [];
×
2158

2159
    let localOffset = 0;
×
2160
    let hasResults = true;
×
2161

2162
    minX -= this.tolerance;
×
2163
    maxX += this.tolerance;
×
2164
    minY -= this.tolerance;
×
2165
    maxY += this.tolerance;
×
2166

2167
    const queryColumns = this.featureDao.getIdAndGeometryColumnNames();
×
2168

2169
    while (hasResults) {
×
2170
      hasResults = false;
×
2171

2172
      const resultSet: FeatureResultSet = this.featureDao.queryForChunkWithDistinctAndColumns(
×
2173
        distinct,
2174
        queryColumns,
2175
        where,
2176
        whereArgs,
2177
        undefined,
2178
        undefined,
2179
        orderBy,
2180
        this.chunkLimit,
2181
        localOffset,
2182
      );
2183
      while (resultSet.moveToNext()) {
×
2184
        hasResults = true;
×
2185

2186
        const featureRow: FeatureRow = resultSet.getRow();
×
2187
        const envelope: GeometryEnvelope = featureRow.getGeometryEnvelope();
×
2188
        if (envelope != null) {
×
2189
          const minXMax = Math.max(minX, envelope.minX);
×
2190
          const maxXMin = Math.min(maxX, envelope.maxX);
×
2191
          const minYMax = Math.max(minY, envelope.minY);
×
2192
          const maxYMin = Math.min(maxY, envelope.maxY);
×
2193

2194
          if (minXMax <= maxXMin && minYMax <= maxYMin) {
×
2195
            if (offset <= index) {
×
2196
              featureIds.push(featureRow.getId());
×
2197
              if (featureIds.length >= limit) {
×
2198
                break;
×
2199
              }
2200
            }
2201
            index++;
×
2202
          }
2203
        }
2204
      }
2205

2206
      localOffset += this.chunkLimit;
×
2207
    }
2208

2209
    return new ManualFeatureQueryResults(this.featureDao, featureIds, columns);
×
2210
  }
2211
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc