Package Exports
- bbox-helper-functions
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bbox-helper-functions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
bbox-helper-functions
Installation
Using npm npm i bbox-helper-functions
Using yarn yarn add bbox-helper-functions
Usage
In CommonJS env
const { getWKBBox } = require('bbox-helper-functions');
const bbox = getWKBBox(
'POLYGON((-3.706512451171875 40.420074462890625,-3.70513916015625 40.420074462890625,-3.70513916015625 40.42144775390625,-3.706512451171875 40.42144775390625,-3.706512451171875 40.420074462890625))'
);
// bbox will be [minLon, minLat, maxLon, maxLat]
Using imports
import { getGeohashBBox } from 'bbox-helper-functions';
const geohashBBox = getGeohashBBox('ezjmun');
// geohashBBox will be [minLon, minLat, maxLon, maxLat]
Table of contents
Interfaces
Type aliases
Functions
- BBoxToCorners
- BBoxToGeoJSONFeature
- BBoxToGeoJSONPolygon
- BBoxToWK
- getBBoxSQLSentence
- getDatasetBBox
- getGeoJSONBBox
- getGeohashBBox
- getWKBBox
- isBBoxInsideBBox
- isPointInsideBBox
Type aliases
AccessorFunction
Ƭ AccessorFunction: (item
: any) => number
Type declaration:
▸ (item
: any): number
Parameters:
Name | Type |
---|---|
item |
any |
Returns: number
Defined in: modules/datasets.ts:4
BBox
Ƭ BBox: [number, number, number, number]
Defined in: modules/bbox.ts:2
Functions
BBoxToCorners
▸ BBoxToCorners(bbox
: BBox): Corners
Gets corners from a bbox
export
Parameters:
Name | Type | Description |
---|---|---|
bbox |
BBox | BBox to get corners of |
Returns: Corners
The corners as [lat, lon] coordinates
Defined in: modules/helpers.ts:84
BBoxToGeoJSONFeature
▸ BBoxToGeoJSONFeature(bbox
: BBox, properties?
: GeoJsonProperties): Feature<Polygon>
Parameters:
Name | Type |
---|---|
bbox |
BBox |
properties |
GeoJsonProperties |
Returns: Feature<Polygon>
Defined in: modules/geojson.ts:17
BBoxToGeoJSONPolygon
▸ BBoxToGeoJSONPolygon(bbox
: BBox): Polygon
Parameters:
Name | Type |
---|---|
bbox |
BBox |
Returns: Polygon
Defined in: modules/geojson.ts:6
BBoxToWK
▸ BBoxToWK(bbox
: BBox, type?
: WKType): string | Buffer
Converts a BBox to WK
export
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
bbox |
BBox | - | The BBox to convert to WK |
type |
WKType | 'wkt' | - |
Returns: string | Buffer
The resulting WK
Defined in: modules/wk.ts:15
getBBoxSQLSentence
▸ getBBoxSQLSentence(bbox
: BBox, latitudeCol
: string, longitudeCol
: string): string
Gets a SQL sentence to use to filter a BBox Checks if a certain column value is inside a BBox
export
Parameters:
Name | Type | Description |
---|---|---|
bbox |
BBox | The BBox to use as filter |
latitudeCol |
string | The latitude column name |
longitudeCol |
string | The longitude column name |
Returns: string
The SQL sentence
Defined in: modules/sql.ts:15
getDatasetBBox
▸ getDatasetBBox(dataset
: any[], datasetOptions?
: DatasetOptions): BBox
Gets the BBox of an array of objects
export
Parameters:
Name | Type | Description |
---|---|---|
dataset |
any[] | Dataset to find BBox of |
datasetOptions |
DatasetOptions | - |
Returns: BBox
The dataset's bbox
Defined in: modules/datasets.ts:52
getGeoJSONBBox
▸ getGeoJSONBBox(geojson
: GeoJSON): BBox
Parameters:
Name | Type |
---|---|
geojson |
GeoJSON |
Returns: BBox
Defined in: modules/geojson.ts:25
getGeohashBBox
▸ getGeohashBBox(geohash
: string): BBox
Parameters:
Name | Type |
---|---|
geohash |
string |
Returns: BBox
Defined in: modules/geohash.ts:4
getWKBBox
▸ getWKBBox(wk
: string | Buffer): BBox
Gets the BBox of a WK
export
Parameters:
Name | Type | Description |
---|---|---|
wk |
string | Buffer | The WK to get BBox of |
Returns: BBox
The WK BBox
Defined in: modules/wk.ts:29
isBBoxInsideBBox
▸ isBBoxInsideBBox(bboxToCheck
: BBox, bboxContainer
: BBox): boolean
Checks if a BBox is completely contained in another BBox
export
Parameters:
Name | Type | Description |
---|---|---|
bboxToCheck |
BBox | The BBox to check if it's inside |
bboxContainer |
BBox | The BBox container |
Returns: boolean
Whether the BBox is inside the other BBox
Defined in: modules/bbox.ts:17
isPointInsideBBox
▸ isPointInsideBBox(point
: GeoPoint, bbox
: BBox): boolean
Checks if a point is inside a BBox
export
Parameters:
Name | Type | Description |
---|---|---|
point |
GeoPoint | The point to check |
bbox |
BBox | The BBox to check |
Returns: boolean
Whether the point is inside the BBox
Defined in: modules/bbox.ts:37