utils
- Description:
Utility functions for processing data.
- Source:
Methods
(static) formatBookPage(input) → {Object}
- Description:
Parses a string to extract the book and page components. The input format should be either
part1-part2
orpart1 part2
.
- Source:
Example
const { book, page } = formatBookPage("123-456");
console.log(book, page); // "123", "456"
Parameters:
Name | Type | Description |
---|---|---|
input |
string | The string input containing book and page information. |
Returns:
An object containing the parsed book and page values.
- Type
- Object
(static) formatTimestampToDate(timestamp) → {string}
- Description:
Converts a timestamp into a human-readable date string in the format MM/DD/YYYY.
- Source:
Example
const date = formatTimestampToDate(1672531200000);
console.log(date); // "01/01/2023"
Parameters:
Name | Type | Description |
---|---|---|
timestamp |
number | The Unix timestamp in milliseconds. |
Returns:
The formatted date string.
- Type
- string
(static) generateAttributes(attributes, schema, spatialReference, county)
- Description:
Generates a set of attributes based on the provided schema and input attributes.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
attributes |
The input attributes to be processed. |
|
schema |
The schema keys that define how to process the attributes. |
|
spatialReference |
The spatial reference information. |
|
county |
The name of the county for reference in the output. |
Returns:
An object containing the processed attributes.
The function processes the following:
- Splits deed and plat book/page information if specified in the schema.
- Formats the last sale timestamp if specified in the schema.
- Constructs owner name and address strings based on the schema keys.
- Constructs text references for property sale and plat information.
The final attributes object includes:
spatialReference
: The provided spatial reference or an empty string.LegalDescr
: The legal description or "N/F" if not provided.OwnerName
: The owner name prefixed with "N/F" if a legal description is provided.PIN
: The property identification number.Address
: The concatenated address string.DeedBook
: The deed book number or "XXX" if not provided.DeedPage
: The deed page number or "XXX" if not provided.PlatBook
: The plat book number or null if not provided.PlatPage
: The plat page number or null if not provided.platRefText
: The uppercase reference text for the plat book/page.lastPropertySaleText
: The uppercase text for the last property sale.lastPropertySaleDeedText
: The uppercase text for the deed book/page.
(static) isPointInBbox(point, bbox) → {boolean}
- Description:
Checks if a given point lies inside a bounding box.
- Source:
Example
const point: Position = [-79.5, 34.5];
const bbox: [number, number, number, number] = [-80, 34, -79, 35];
console.log(isPointInBbox(point, bbox)); // true
Parameters:
Name | Type | Description |
---|---|---|
point |
Position | A GeoJSON position represented as [longitude, latitude]. |
bbox |
BBOX | The bounding box, represented as [xmin, ymin, xmax, ymax]. |
Returns:
Returns true
if the point is inside the bounding box, otherwise false
.
- Type
- boolean
(static) splitPathAtBbox(path, bbox) → {Array.<Array.<Position>>}
- Description:
Splits a path at the edges of a bounding box. Iterates through the path and creates segments of points that are inside the bounding box.
- Source:
Example
const path: Position[] = [[-80, 34], [-79.5, 34.5], [-79, 35]];
const bbox: [number, number, number, number] = [-80, 34, -79, 35];
const segments = splitPathAtBbox(path, bbox);
console.log(segments);
// Output: [
// [[-80, 34], [-79.5, 34.5], [-79, 35]]
// ]
Parameters:
Name | Type | Description |
---|---|---|
path |
Array.<Position> | An array of GeoJSON positions representing the path to split. |
bbox |
BBOX | The bounding box, represented as [xmin, ymin, xmax, ymax]. |
Returns:
An array of path segments, where each segment is an array of positions inside the bounding box.
- Type
- Array.<Array.<Position>>