anchorScore | - |
aquacultureScore | - |
area | Calculates the area of each sketch and collection. |
batchDelete | - |
batchDeleteTasks | Batch delete array of tasks |
bboxOverlap | Returns whether bounding box A overlaps with or touches bounding box B |
biggestPolygon | If feature is a MultiPolygon, scans and returns the polygon with the largest area. |
booleanOverlap | Returns all B items that overlap with a A items Not all Feature types are supported, see typedoc A and B must have the same geometry dimension (single or multi). Builds on @turf/boolean-overlap. |
byteSize | Get length of string in bytes |
callWithRetry | Calls given function and if error thrown, it recursively retries function up to maxTry times, then just rethrows the error |
capitalize | Capitalizes the first letter of string |
chunk | Splits an array into chunks of size |
classIdMapping | Returns mapping of class ID to class DataClass objects |
classifyMPA | Given zone scores, returns object containing final scores, and mpa classification |
classifyZone | Given activity scores, returns zone number |
cleanBBox | Normalizes bounding box longitude values to the [-180, 180] range if they cross the antimeridian |
cleanCoords | Cleans geojson coordinates to be within the bounds of the world [-90, -180, 90, 180], so that they don't wrap off the end, and can be split |
clip | Performs one of 4 different clip operations on features |
clipMultiMerge | Performs clip after first merging features2 coords into a single multipolygon. Avoids errors in underlying clipping library when too many features in features2 |
clipToPolygonDatasources | Takes a Polygon feature and returns the portion remaining after performing clipOperations against one or more datasources |
clipToPolygonFeatures | Takes a Polygon feature and returns the portion remaining after performing clipOperations against one or more Polygon features |
collectionHasGeometry | - |
createMetric | Creates a new metric. Defaults to ID values of null and then copies in passed metric properties |
createMetrics | Creates fully defined metrics from partial. Metric values not provided are initialized to null |
ensureValidPolygon | Returns true if feature is valid and meets requirements set by options. |
featureToSketch | Converts Feature to Sketch with reasonable defaults given for sketch properties if not provided |
featureToSketchCollection | Converts FeatureCollection to SketchCollection with reasonable defaults given for sketch properties if not provided |
fetchGeoJSON | Given geoprocessing function request, fetches the GeoJSON, which can also be sketch JSON |
fgbFetchAll | Fetch features from flatgeobuf at url that intersect with bounding box Retries up to 3 times if fetch fails in error |
fgBoundingBox | - |
findAndUpdateMetricValue | Returns new sketchMetrics array with first sketchMetric matched set with new value. If no match, returns copy of sketchMetrics. Does not mutate array in place. |
firstMatching | Returns the first item that returns true for filter |
firstMatchingMetric | Returns the first metric that returns true for metricFilter |
flattenByGroupAllClass | Aggregates metrics by group |
flattenByGroupSketchAllClass | Flattens group class metrics, one for each group and sketch. Each object includes the percValue for each class, and the total percValue with classes combined groupId, sketchId, class1, class2, ..., total |
flattenBySketchAllClass | Flattens class sketch metrics into array of objects, one for each sketch, where each object contains sketch id, sketch name, and all metric values for each class |
flattenSketchAllId | Returns one aggregate object for every sketch ID present in metrics, with additional property for each unique value for idProperty present for sketch. Example - idProperty of 'classId', and two classes are present in metrics of 'classA', and 'classB' then each flattened object will have two extra properties per sketch, .classA and .classB, each with the first metric value for that sketch/idProperty found |
gearTypeScore | - |
genClipToPolygonDatasources | Returns a function that Takes a Polygon feature and returns the portion remaining after performing clipOperations against one or more datasources |
genClipToPolygonFeatures | Returns a function that applies clip operations to a feature using other polygon features. |
genFeature | Returns a Feature with given features geometry and properties. Reasonable defaults are given for properties not provided Default geometry is a square from 0,0 to 1,1 |
genFeatureCollection | Given array of features, return a feature collection with given properties. Generates reasonable default values for any properties not passed in The geometry type of the returned collection will match the one passed in Properties of features are retained |
genRandomPolygons | Generates random polygons within provided bounds. numPolygons defaults to 300, max_radial_length to 0.5 Wrapper around @turf/random - https://turfjs.org/docs/#randomPolygon |
genSampleNullSketch | Returns a Sketch with given geometry and Geometry type, Properties are reasonable random |
genSampleNullSketchCollection | Given feature collection, return a sketch collection with reasonable random props. The geometry type of the returned collection will match the one passed in |
genSampleSketch | Returns a Sketch with given geometry and Geometry type, Properties are reasonable random |
genSampleSketchCollection | Given feature collection, return a sketch collection with reasonable random props. The geometry type of the returned collection will match the one passed in |
genSampleSketchCollectionFromSketches | Given feature collection, return a sketch collection with reasonable random props. The geometry type of the returned collection will match the one passed in |
genSampleSketchContext | - |
genSampleUserAttributes | - |
genSketch | Returns a Sketch with given features geometry and properties. Reasonable defaults are given for properties not provided Default geometry is a square from 0,0 to 1,1 |
genSketchCollection | Given array of sketches, return a sketch collection with given properties. Generates reasonable default values for any properties not passed in The geometry type of the returned collection will match the one passed in Properties of sketches are retained |
genTaskCacheKey | Generates a cache key for a geoprocessing request, given sketch properties and optional extra parameters (must be JSON compatible object) Extra parameters are canonicalized and hashed using md5 to ensure cache key is consistent. Canonicalization ensures object keys are consistent but not arrays. If you use arrays as extraParam values, make sure the order stays the same and sort first if needed to generate a consistent cache key. |
genZodErrorMessage | - |
getArea | Returns area of valid raster cells (not nodata) overlapping with feature. If no valid cells found, returns 0. |
getClassificationLabel | - |
getCogFilename | - |
getDatasetBucketName | - |
getDatasourceById | find and return datasource from passed datasources |
getDatasourceFeatures | Fetches and returns features for a given datasource supporting a variety of formats/clients |
getExternalRasterDatasourceById | find and return external raster datasource from passed datasources |
getExternalVectorDatasourceById | find and return external vector datasource from passed datasources |
getFeatures | Fetches and returns features for a given datasource supporting a variety of formats/clients |
getFeaturesForBBoxes | Loads features from a FlatGeobuf referenced by URL, which intersect the bounding boxes. Deduplicates features given uniqueIdProperty (faster) or using md5 hash of feature coordinates (slower). |
getFeaturesForSketchBBoxes | 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 | Returns first element from param object at paramName key. Parameter can be string or array of strings |
getFlatGeobufFilename | Returns datasource filename in flatgeobuf format |
getFlatGeobufPath | - |
getGeopackagePath | - |
getHistogram | Returns histogram of value overlap with geometry. If no cells with a value are found within the geometry overlap, returns 0. |
getIndexIconPerc | Returns percent protection given index value, percent is proportion (percent) of bottom color to top color to use for icon given index value (as shown in paper) e.g. index = 5.4 means bottom icon color should take 25% of icon and top color 75% |
getInternalRasterDatasourceById | find and return internal datasource from passed datasources |
getInternalVectorDatasourceById | find and return internal vector datasource from passed datasources |
getIucnCategoryForActivities | Given list of allowed activities in the sketch, returns the highest category allowable The lack of an activity assumes it is not allowed |
getIucnCategoryForSketches | Return Category for each sketch keyed by sketchId |
getIucnCategoryNameForSketches | Return Category name for each sketch keyed by sketchId |
getIucnLevelNameForSketches | Return level name for each sketch keyed by sketchId |
getJsonFilename | Returns datasource filename in geojson format |
getJsonPath | - |
getJsonUserAttribute | - |
getKeys | Object.keys helper that returns strongly typed key values. Uses assertion so make sure your type covers all the keys! |
getMetricGroupObjectiveId | Returns the objectiveId assigned to the given MetricGroup. If classId provided, returns the objective ID assigned to data class with that classId, else fallback to metricGroup objectiveId. |
getMetricGroupObjectiveIds | Returns array of objective IDs for the given MetricGroup. If at least one class has an objectiveId assigned, then it returns those, missing classes with no objectiveId get the top-level objectiveId If no class-level objectives are found, then it returns the top-level objectiveId If no objectives are found, returns an empty array |
getMinYesCountMap | Returns an object mapping objective ID to ID of first classification that counts toward objective |
getMpaClassificationName | Returns protection level given MPA classification index value |
getObjectiveById | find and return objectives from passed objectives |
getParamStringArray | Validates and returns string[] parameter from extraParams. If param missing it returns an empty array |
getRasterBoxSpherical | - |
getRasterDatasourceById | find and return raster datasource (internal or external) from passed datasources |
getSketchCollectionChildIds | Given sketch collection, returns IDs of sketches in the collection |
getSketchFeatures | Given sketch or sketch collection, returns just the individual sketch features inside. |
getSketchToMpaProtectionLevel | Returns object mapping sketch id to MPA classification given sketch for rbcsMpa or collection of sketches for rbcsMpas with rbcs activity userAttributes, and area metrics for each sketch, assumes each mpa is a single zone mpa |
getSum | Returns sum of raster value overlap with geometry. If no cells with a value are found within the geometry overlap, returns 0. |
getUserAttribute | UserAttributes are those filled in via the attributes form specified as part of a SketchClass. This getter function is easier to use than searching the Sketch.properties.userAttributes array, supports default values, and is easier to use with typescript. |
getVectorDatasourceById | find and return vector datasource (internal or external) from passed datasources |
getZoneClassificationName | - |
groupBy | Similar to lodash groupBy |
hasOwnProperty | Type narrowing to allow property checking when object can be multiple types https://fettblog.eu/typescript-hasownproperty/ Any code inside a block guarded by a conditional call to this function will have type narrowed to X |
includeVirtualSketch | If sketch collection passes sketchTest, then returns new collection with mergeSketchColl sketches appended and updated bbox |
intersectInChunks | Calculates area overlap between a feature A and a feature array B. Intersection is done in chunks on featuresB to avoid errors due to too many features |
intersectSum | Returns an object containing the sum value of features in B that intersect with featureA, and the indices of the features in B that intersect with featureA No support for partial overlap, counts the whole feature if it intersects. |
isExternalDatasource | - |
isExternalRasterDatasource | - |
isExternalVectorDatasource | - |
isFeature | Check if object is a Feature. Any code inside a block guarded by a conditional call to this function will have type narrowed |
isFeatureCollection | Check if object is a Feature Collection. Any code inside a block guarded by a conditional call to this function will have type narrowed |
isGeometry | Check if object is a Feature. Any code inside a block guarded by a conditional call to this function will have type narrowed to Feature |
isImportRasterDatasourceConfig | - |
isImportVectorDatasourceConfig | - |
isinternalDatasource | - |
isInternalRasterDatasource | - |
isInternalVectorDatasource | - |
isLineStringFeature | Check if object is a Linestring. Any code inside a block guarded by a conditional call to this function will have type narrowed |
isLineStringSketchCollection | - |
isMetric | Checks if object is a Metric and returns narrowed type |
isMetricArray | Checks if object is a Metric array and returns narrowed type |
isMetricPack | Checks if object is a MetricPack. Any code inside a block guarded by a conditional call to this function will have type narrowed to MetricPack |
isMultiPolygonFeature | Check if object is a MultiPolygon. Any code inside a block guarded by a conditional call to this function will have type narrowed |
isMultiPolygonSketch | Checks if sketch is a MultiPolygon. Any code inside a block guarded by a conditional call to this function will have type narrowed to Sketch |
isMultiPolygonSketchCollection | - |
isNullSketch | Checks if object is a NullSketch. Any code inside a block guarded by a conditional call to this function will have type narrowed to NullSketch |
isNullSketchCollection | Check if object is a NullSketchCollection. Any code inside a block guarded by a conditional call to this function will have type narrowed to NullSketchCollection |
isObject | - |
isPointFeature | Check if object is a Point. Any code inside a block guarded by a conditional call to this function will have type narrowed |
isPointSketchCollection | - |
isPolygonAllSketchCollection | - |
isPolygonAnyFeature | Check if object is a Polygon or MultiPolygon. Any code inside a block guarded by a conditional call to this function will have type narrowed |
isPolygonFeature | Check if object is a Polygon feature. Any code inside a block guarded by a conditional call to this function will have type narrowed |
isPolygonFeatureArray | Check if object is an array of Polygon features. Any code inside a block guarded by a conditional call to this function will have type narrowed |
isPolygonSketch | Checks if sketch is a Polygon |
isPolygonSketchCollection | - |
isRasterDatasource | - |
isRbcsProtectionLevel | Type guard for checking string is one of supported objective IDs Use in conditional block logic to coerce to type RbcsObjectiveKey within the block |
isSketch | Checks if object is a Sketch. Any code inside a block guarded by a conditional call to this function will have type narrowed to Sketch |
isSketchCollection | Check if object is a SketchCollection. Any code inside a block guarded by a conditional call to this function will have type narrowed to SketchCollection |
isTruthyAttributeValue | - |
isVectorDatasource | - |
keyBy | Similar to lodash keyBy |
loadCog | Returns cog-aware georaster at given url. If fetch fails, will retry up to 3 times Will not fetch raster values until subsequent geoblaze calls are made with a geometry and it will calculate the window to load based on the geometry. The subsequent geoblaze calls (e.g. sum) must be called async to allow the raster to load. |
loadFgb | Fetch features from flatgeobuf at url that intersect with bounding box Retries up to 3 times if fetch fails in error |
loadFgbFromDisk | Synchronously load a flatgeobuf file from disk. Assumed to be in WGS84 EPSG:4326 projection |
maxWidth | Returns the maximum width of the geojson or bbox |
metricsForSketch | Returns metrics for given sketch (can be an array of sketches) |
metricsSketchIds | Returns metrics with matching sketchId (can be an array of sketchids) |
metricsWithClassId | Returns metrics with matching sketchId (can be an array of sketchids) |
metricsWithSketchId | Returns metrics with matching sketchId (can be an array of sketchids) |
minWidth | Returns the minimum width of the bounding box of given feature |
mpaClassMetric | Given sketch for rbcsMpa with rbcs activity userAttributes, assumes mpa is a single zone mpa and returns metrics with mpa classification score |
mpaClassMetrics | Given sketch for rbcsMpa or collection of sketches for rbcsMpas with rbcs activity userAttributes, assumes each mpa is a single zone mpa and returns metrics with mpa classification score Collection metric will have mpa classification score index as value |
nestMetrics | Recursively groups metrics by ID in order of ids specified to create arbitrary nested hierarchy for fast lookup. Caller responsible for all metrics having the ID properties defined If an id property is not defined on a metric, then 'undefined' will be used for the key |
numberFormat | Formats number to string, if less than zero will leave as-is, otherwise will format as large number |
overlapArea | Assuming sketches are within some outer boundary with size outerArea, calculates metric for both the area of each sketch and the percentage of outerArea they take up. If sketch is a collection, will return metrics for each child sketch as well as the collection collection level metric will calculated by unioning child sketches to remove overlap. If collection level calculation produces an "Unable to complete output ring" error, it will fallback to simplify the sketch with simplifyTolerance (default to .0000001 if not passed) and try again. |
overlapAreaGroupMetrics | Generate overlap group metrics using overlapArea operation |
overlapFeatures | Calculates overlap between sketch(es) and an array of polygon features. Supports area or sum operation (given sumProperty), defaults to area If sketch collection includes overall and per sketch |
overlapFeaturesGroupMetrics | Generate overlap group metrics using overlapFeatures operation |
overlapGroupMetrics | Given overlap metrics stratified by class and sketch, returns new metrics also stratified by group Assumes a sketch is member of only one group, determined by caller-provided metricToGroup For each group+class, calculates area of overlap between sketches in group and featuresByClass (with overlap between group sketches removed first) Types of metrics returned: sketch metrics: copy of caller-provided sketch metrics with addition of group ID overall metric for each group+class: takes sketches in group, subtracts overlap between them and overlap with higher group sketches, and runs operation If a group has no sketches in it, then no group metrics will be included for that group, and group+class metric will be 0 |
overlapPolygonArea | Calculates area of overlap between sketch(es) and an array of polygon features. Truncates input geometry coordinates down to 6 decimal places (~1m accuracy) before intersection to avoid floating point precision issues. If sketch collection, then calculates area for each child sketch and the whole collection, without overcounting sketch overlap |
overlapPolygonSum | Calculates area overlap between sketch(es) and an array of polygon features. Truncates input geometry coordinates down to 6 decimal places (~1m accuracy) before intersection to avoid floating point precision issues. If sketch collection, then calculates area per sketch and for sketch collection |
overlapRasterClass | Calculates sum of overlap between sketches and a categorical raster with numeric values representing feature classes If sketch collection, then calculate overlap for all child sketches also |
overlapRasterGroupMetrics | Generate overlap group metrics using rasterMetrics operation |
overlapSubarea | Returns area stats for sketch input after performing overlay operation against a subarea feature. Includes both area overlap and percent area overlap metrics, because calculating percent later would be too complicated For sketch collections, dissolve is used when calculating total sketch area to prevent double counting |
packMetrics | Converts Metric array to a new MetricPack. Assumes metric dimensions are consistent for each element in the array, and null values are used |
parseGeoraster | - |
parseLambdaResponse | Parses result from worker lambda |
percentGoalWithEdge | Special percent formatter designed to produce readable percent values for display given an upper percent goal All parameters are expected to be decimal percent values e.g. .001 = 1/10th of a percent. |
percentWithEdge | Special percent formatter designed to produce readable percent values for display with special handling of numbers within some edge range of user-defined lower or upper bounds. Defaults to handle only lower edge with lowerBound = 0 and lower = .001. All bound values are expected to be in decimal percent. So 1/10th of a percent is .001 |
randomFloat | - |
randomInt | - |
rasterMetrics | Calculates summary metrics (stats/area) on given raster, optionally intersecting raster with provided feature (zonal statistics). If feature is a collection, then calculate metrics for each individual feature as well as the collection as a whole. This can be disabled with includeChildMetrics: false. Defaults to assuming a continuous raster but also supports categorical option |
rasterStats | Calculates over 10 different raster statistics, optionally constrains to raster cells overlapping with feature (zonal statistics). Defaults to calculating only sum stat If no raster cells with value found, returns 0 or null value for each stat as appropriate. |
rasterStatsToMetrics | Converts an array of geoblaze raster StatsObject to an array of Metrics |
rbcsMpaToMetric | - |
rbcsZoneToMetric | Transforms an rbcs zone object to a metric |
rekeyMetrics | Reorders metrics (by mutation) to a consistent key order for readability |
rekeyObject | Reorders object, mutating in place, in the order provided |
removeOverlap | Removes overlap between polygons and returns result as a single polygon or multipolygon The result has no connection to the original features and their properties in this process |
removeSketchCollPolygonHoles | - |
removeSketchPolygonHoles | - |
roundDecimal | Rounds number to a fixed number of decimals |
roundDecimalFormat | Rounds number to a fixed number of decimals, then formats as a human readable string |
roundLower | Formats number to string, rounding decimal to number of digits, if value is less than lower will clamp to lower value |
runLambdaWorker | Runs a function on a specified lambda worker |
sampleSketchReportContextValue | Creates a ReportContextValue object for a Sketch with sample values. overrides will be merged in, replacing default values |
scanTasks | - |
sketchToId | Given sketch(es), returns ID(s) |
sketchToZone | - |
sortMetrics | Sorts metrics to a consistent order for readability Defaults to [metricId, classId, sketchId] |
sortMetricsDisplayOrder | Sorts metrics by ID given a user-defined metric dimension (sortId) and array of ID values in the order they should be sorted Useful for applying a "display order" to metrics Example - sortId = classId, displayOrder = ['sand','gravel','coral'] |
splitBBoxAntimeridian | If bounding box crosses antimeridian (and extends outside the range of -180 to 180), split it into two bounding boxes at the antimeridian. |
splitFeatureAntimeridian | Splits a Feature or FeatureCollection on the 180 degree antimeridian. The bbox property of the result will have longitude coordinates that are shifted/normalized to be within the range of -180 to 180. |
splitSketchAntimeridian | Splits a Sketch or SketchCollection on the 180 degree antimeridian The bbox property of the result will have longitude coordinates that are shifted/normalized to be within the range of -180 to 180. |
squareMeterToKilometer | Converts value from square meters to square kilometers |
squareMeterToMile | Converts value from square meters to square miles |
testWithinPerc | Expects that testValue is equal to expectedValue or optionally within percentage (defaults to .01 or 1%) |
toChildProperties | Returns SketchProperties for each child sketch in a SketchCollection |
toFeatureArray | Helper to convert a Feature or a FeatureCollection to a Feature array |
toFeaturePolygonArray | - |
toJsonFile | - |
toMultiPolygon | Converts collection of polygons or multipolygons to a single multipolygon |
toNullSketch | Returns sketch or sketch collection with null geometry |
toNullSketchArray | Helper to convert a NullSketch or NullSketchCollection to a NullSketch array |
toPercentMetric | Matches numerator metrics with denominator metrics and divides their value, returning a new array of percent metrics. Matches on the optional idProperty given, otherwise defaulting to classId Deep copies and maintains all other properties from the numerator metric If denominator metric has value of 0, returns NaN NaN allows downstream consumers to understand this isn't just any 0. It's an opportunity to tell the user that no matter where they put their sketch, there is no way for the value to be more than zero. For example, the ClassTable component looks for NaN metric values and will automatically display 0%, along with an informative popover explaining that no data class features are within the current geography. |
toRasterProjection | Reprojects a feature to the same projection as the raster. |
toShortSketches | Returns an array of shorthand sketches (id + name) given a Sketch or SketchCollection. Includes a shorthand of parent collection also |
toSketchArray | Converts a Sketch or SketchCollection to a Sketch array, maintaining geometry type Useful for putting in a consistent form that can be iterated over |
toSketchPropertiesArray | Converts array of sketches to an array of their SketchProperties |
unpackMetrics | Converts MetricPack to a new Metric array. |
updateCommandsSync | Run dynamodb update commands synchronously to avoid throttling, retrying on ThroughputError |
valueFormatter | Given a number or string value and the name of a formatter function, returns a formatted value |
zeroPolygon | Returns a zero polygon geometry (three [0,0] coordinates) |
zeroSketch | Given sketch, returns the mutated sketch with a zero polygon geometry (three [0,0] coordinates) |
zeroSketchArray | Given sketch array, returns the mutated sketches with a zero polygon geometry (three [0,0] coordinates) |
zeroSketchCollection | Given sketch collection, returns the mutated collection with all child sketches switched to have zero polygon geometry (three [0,0] coordinates) |
zoneClassMetrics | Given sketch for rbcsZone or collection of zone sketches with userAttributes for rcbs activities, returns metrics with zone classification score as value. If sketch collection, collection metric will have mpa classification score index as value |