Skip to content

Commit

Permalink
Make MetricGroup type property optional, rebuild docs
Browse files Browse the repository at this point in the history
  • Loading branch information
twelch committed Nov 22, 2024
1 parent f101820 commit 8a3ebaa
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/geoprocessing/src/types/metricGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { z } from "zod";
export const metricGroupSchema = z.object({
/** Unique id of metric in project*/
metricId: z.string(),
/** data classes used by group */
classes: z.array(dataClassSchema),
/** unique identifier of what the metric represents, such as its type and method for calculation - e.g. areaOverlap, valueOverlap. To be defined by the user */
type: z.string(),
type: z.string().optional(),
/** Datasource to generate metrics from */
datasourceId: z.string().optional(),
/** Optional datasource class key used to source classIds */
classKey: z.string().optional(),
/** data classes used by group */
classes: z.array(dataClassSchema),
/** Optional ID of map layer associated with this metric */
layerId: z.string().optional(),
/** group level objective, applies to all classes */
Expand Down
6 changes: 6 additions & 0 deletions website/docs/api/dataproviders/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ Re-exports [getFeatures](../geoprocessing/functions/getFeatures.md)

***

### getFeaturesForSketchBBoxes

Re-exports [getFeaturesForSketchBBoxes](../geoprocessing/functions/getFeaturesForSketchBBoxes.md)

***

### loadCog

Re-exports [loadCog](../geoprocessing/functions/loadCog.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# getFeaturesForSketchBBoxes()

```ts
function getFeaturesForSketchBBoxes(
sketch,
fgbUrl,
uniqueIdProperty?): Promise<Feature<Polygon | MultiPolygon, GeoJsonProperties>[]>
```

Loads features from a FlatGeobuf referenced by URL, which intersect the
bounding boxes of each individual sketch in a SketchCollection, or a single
Sketch.

In the case of a SketchCollection, it is possible that duplicate features may
be fetched in the case of overlapping bounding boxes or very large features
that span multiple bounding boxes. This function will de-dupe those features.
Ideally, there is a feature.id property set. If not the caller can provide a
uniqueIdProperty to de-dupe features. If neither is provided, a hash of the
feature coordinates will be used.

If feature.id is not available, and uniqueIdProperty is not provided, there
is the potential for elimination of features that are geometrically identical
but have different properties.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `sketch` | [`Sketch`](../interfaces/Sketch.md)\<[`SketchGeometryTypes`](../type-aliases/SketchGeometryTypes.md)\> \| [`SketchCollection`](../interfaces/SketchCollection.md)\<[`SketchGeometryTypes`](../type-aliases/SketchGeometryTypes.md)\> | Sketch or SketchCollection |
| `fgbUrl` | `string` | FlatGeobuf location |
| `uniqueIdProperty`? | `string` | Used to de-dupe features when feature.id is not available |

## Returns

`Promise`\<[`Feature`](../interfaces/Feature.md)\<[`Polygon`](../interfaces/Polygon.md) \| [`MultiPolygon`](../interfaces/MultiPolygon.md), [`GeoJsonProperties`](../type-aliases/GeoJsonProperties.md)\>[]\>

array of features
1 change: 1 addition & 0 deletions website/docs/api/geoprocessing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
| [getExternalRasterDatasourceById](functions/getExternalRasterDatasourceById.md) | find and return external raster datasource from passed datasources |
| [getExternalVectorDatasourceById](functions/getExternalVectorDatasourceById.md) | find and return external vector datasource from passed datasources |
| [getFeatures](functions/getFeatures.md) | Returns features for a variety of vector datasources and formats, with additional filter options |
| [getFeaturesForSketchBBoxes](functions/getFeaturesForSketchBBoxes.md) | Loads features from a FlatGeobuf referenced by URL, which intersect the bounding boxes of each individual sketch in a SketchCollection, or a single Sketch. |
| [getFirstFromParam](functions/getFirstFromParam.md) | Returns first element from param object at paramName key. Parameter can be string or array of strings |
| [getFlatGeobufFilename](functions/getFlatGeobufFilename.md) | Returns datasource filename in flatgeobuf format |
| [getFlatGeobufPath](functions/getFlatGeobufPath.md) | - |
Expand Down
5 changes: 5 additions & 0 deletions website/docs/api/typedoc-sidebar.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,11 @@ const typedocSidebar = { items: [
"id": "api/geoprocessing/functions/getFeatures",
"label": "getFeatures"
},
{
"type": "doc",
"id": "api/geoprocessing/functions/getFeaturesForSketchBBoxes",
"label": "getFeaturesForSketchBBoxes"
},
{
"type": "doc",
"id": "api/geoprocessing/functions/getFirstFromParam",
Expand Down

0 comments on commit 8a3ebaa

Please sign in to comment.