Utils: `geo`
Table of contents
Variables
Functions
- geoContains
- geoContainsFP
- geoDisjoint
- geoDisjointFP
- geoIntersects
- geoIntersectsFP
- geoPointWithinRange
- geoPointWithinRangeFP
- geoPolyHasPoint
- geoRelationFP
- geoWithin
- geoWithinFP
- inGeoBoundingBox
- inGeoBoundingBoxFP
- isGeoJSON
- isGeoPoint
- isGeoShapeMultiPolygon
- isGeoShapePoint
- isGeoShapePolygon
- lookupTimezone
- makeCoordinatesFromGeoPoint
- makeGeoBBox
- makeGeoCircle
- makeGeoFeature
- makeGeoFeatureOrThrow
- parseGeoDistance
- parseGeoDistanceUnit
- parseGeoPoint
- polyHasHoles
- toGeoJSON
- toGeoJSONOrThrow
- tzCacheLoaded
- validateListCoords
Variables
geoJSONTypes
• Const
geoJSONTypes: string
[]
Defined in
Functions
geoContains
▸ geoContains(firstGeoEntity
, secondGeoEntity
): boolean
Returns true if the second geometry is completely contained by the first geometry. The interiors of both geometries must intersect and, the interior and boundary of the secondary geometry must not intersect the exterior of the first geometry.
Parameters
Name | Type |
---|---|
firstGeoEntity | GeoInput |
secondGeoEntity | GeoInput |
Returns
boolean
Defined in
geoContainsFP
▸ geoContainsFP(queryGeoEntity
): (input
: unknown
) => boolean
When provided with geoInput that acts as the argument geo-feature, it will return a function that accepts any geoInput and checks to see if the new input contains the argument geo-feature
Parameters
Name | Type |
---|---|
queryGeoEntity | GeoInput |
Returns
fn
▸ (input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
geoDisjoint
▸ geoDisjoint(firstGeoEntity
, secondGeoEntity
): boolean
Returns true if both geo entities have no overlap
Parameters
Name | Type |
---|---|
firstGeoEntity | GeoInput |
secondGeoEntity | GeoInput |
Returns
boolean
Defined in
geoDisjointFP
▸ geoDisjointFP(queryGeoEntity
): (input
: unknown
) => boolean
Parameters
Name | Type |
---|---|
queryGeoEntity | GeoInput |
Returns
fn
▸ (input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
geoIntersects
▸ geoIntersects(firstGeoEntity
, secondGeoEntity
): boolean
Returns true if both geo entities intersect each other, if one of the input geo entity is a point, it will check if the other geo-entity contains the point
Parameters
Name | Type |
---|---|
firstGeoEntity | GeoInput |
secondGeoEntity | GeoInput |
Returns
boolean
Defined in
geoIntersectsFP
▸ geoIntersectsFP(queryGeoEntity
): (input
: unknown
) => boolean
Parameters
Name | Type |
---|---|
queryGeoEntity | GeoInput |
Returns
fn
▸ (input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
geoPointWithinRange
▸ geoPointWithinRange(startingPoint
, distanceValue
, point
): boolean
Parameters
Name | Type |
---|---|
startingPoint | GeoPointInput |
distanceValue | string |
point | GeoPointInput |
Returns
boolean
Defined in
geoPointWithinRangeFP
▸ geoPointWithinRangeFP(startingPoint
, distanceValue
): (input
: unknown
) => boolean
Parameters
Name | Type |
---|---|
startingPoint | GeoPointInput |
distanceValue | string |
Returns
fn
▸ (input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
geoPolyHasPoint
▸ geoPolyHasPoint<G
>(polygon
): (fieldData
: unknown
) => boolean
Type parameters
Name | Type | |
---|---|---|
G | extends Polygon \ | MultiPolygon |
Parameters
Name | Type | |
---|---|---|
polygon | G \ | Feature <G , Properties > |
Returns
fn
▸ (fieldData
): boolean
Parameters
Name | Type |
---|---|
fieldData | unknown |
Returns
boolean
Defined in
geoRelationFP
▸ geoRelationFP(geoShape
, relation
): (input
: unknown
) => boolean
Parameters
Name | Type |
---|---|
geoShape | GeoInput |
relation | GeoShapeRelation |
Returns
fn
▸ (input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
geoWithin
▸ geoWithin(firstGeoEntity
, secondGeoEntity
): boolean
Returns true if the first geometry is completely within the second geometry. The interiors of both geometries must intersect and, the interior and boundary of the first geometry must not intersect the exterior of the second geometry
Parameters
Name | Type |
---|---|
firstGeoEntity | GeoInput |
secondGeoEntity | GeoInput |
Returns
boolean
Defined in
geoWithinFP
▸ geoWithinFP(queryGeoEntity
): (input
: unknown
) => boolean
When provided with geoInput that acts as the parent geo-feature, it will return a function that accepts any geoInput and checks to see if the new input is within the parent geo-feature
Parameters
Name | Type |
---|---|
queryGeoEntity | GeoInput |
Returns
fn
▸ (input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
inGeoBoundingBox
▸ inGeoBoundingBox(top_left
, bottom_right
, point
): boolean
Parameters
Name | Type |
---|---|
top_left | GeoPointInput |
bottom_right | GeoPointInput |
point | GeoPointInput |
Returns
boolean
Defined in
inGeoBoundingBoxFP
▸ inGeoBoundingBoxFP(top_left
, bottom_right
): (input
: unknown
) => boolean
Parameters
Name | Type |
---|---|
top_left | GeoPointInput |
bottom_right | GeoPointInput |
Returns
fn
▸ (input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
isGeoJSON
▸ isGeoJSON(input
): input is GeoShape | ESGeoShape
Parameters
Name | Type |
---|---|
input | unknown |
Returns
input is GeoShape | ESGeoShape
Defined in
isGeoPoint
▸ isGeoPoint(input
): boolean
Parameters
Name | Type |
---|---|
input | unknown |
Returns
boolean
Defined in
isGeoShapeMultiPolygon
▸ isGeoShapeMultiPolygon(input
): input is GeoShapeMultiPolygon
Parameters
Name | Type |
---|---|
input | unknown |
Returns
input is GeoShapeMultiPolygon
Defined in
isGeoShapePoint
▸ isGeoShapePoint(input
): input is GeoShapePoint
Parameters
Name | Type |
---|---|
input | unknown |
Returns
input is GeoShapePoint
Defined in
isGeoShapePolygon
▸ isGeoShapePolygon(input
): input is GeoShapePolygon
Parameters
Name | Type |
---|---|
input | unknown |
Returns
input is GeoShapePolygon
Defined in
lookupTimezone
▸ lookupTimezone(input
): string
Takes in a geo point like entity and returns the timezone of its location
Parameters
Name | Type |
---|---|
input | unknown |
Returns
string
Defined in
makeCoordinatesFromGeoPoint
▸ makeCoordinatesFromGeoPoint(point
): CoordinateTuple
Parameters
Name | Type |
---|---|
point | GeoPoint |
Returns
CoordinateTuple
Defined in
makeGeoBBox
▸ makeGeoBBox(point1
, point2
): Feature
<Polygon
, Properties
>
Parameters
Name | Type |
---|---|
point1 | GeoPoint |
point2 | GeoPoint |
Returns
Feature
<Polygon
, Properties
>
Defined in
makeGeoCircle
▸ makeGeoCircle(point
, distance
, unitVal?
): Feature
<Polygon
> | undefined
Parameters
Name | Type |
---|---|
point | GeoPoint |
distance | number |
unitVal? | GeoDistanceUnit |
Returns
Feature
<Polygon
> | undefined
Defined in
makeGeoFeature
▸ makeGeoFeature(geoShape
): Feature
<any
> | undefined
Converts a geoJSON object to its turf geo feature counterpart
Parameters
Name | Type |
---|---|
geoShape | unknown |
Returns
Feature
<any
> | undefined
Defined in
makeGeoFeatureOrThrow
▸ makeGeoFeatureOrThrow(geoShape
): Feature
<any
>
Converts a geoJSON object to its turf geo feature counterpart, will throw if not valid
Parameters
Name | Type |
---|---|
geoShape | unknown |
Returns
Feature
<any
>
Defined in
parseGeoDistance
▸ parseGeoDistance(str
): GeoDistanceObj
Parameters
Name | Type |
---|---|
str | string |
Returns
GeoDistanceObj
Defined in
parseGeoDistanceUnit
▸ parseGeoDistanceUnit(input
): GeoDistanceUnit
Parameters
Name | Type |
---|---|
input | string |
Returns
GeoDistanceUnit
Defined in
parseGeoPoint
▸ parseGeoPoint(point
): GeoPoint
Convert an input into a Geo Point object with lat and lon
Parameters
Name | Type |
---|---|
point | unknown |
Returns
GeoPoint
Defined in
▸ parseGeoPoint(point
, throwInvalid
): GeoPoint
Parameters
Name | Type |
---|---|
point | unknown |
throwInvalid | true |
Returns
GeoPoint
Defined in
▸ parseGeoPoint(point
, throwInvalid
): GeoPoint
| null
Parameters
Name | Type |
---|---|
point | unknown |
throwInvalid | false |
Returns
GeoPoint
| null
Defined in
polyHasHoles
▸ polyHasHoles(input
): boolean
Parameters
Name | Type |
---|---|
input | GeoShape |
Returns
boolean
Defined in
toGeoJSON
▸ toGeoJSON(input
): GeoShape
| undefined
Only able to convert geo-points to either a geo-json point or a simple polygon. There is no current support for creating polygon with holes or multi-polygon as of right now. geoJSON input is made sure to be properly formatted for its type value
Parameters
Name | Type |
---|---|
input | unknown |
Returns
GeoShape
| undefined
Defined in
toGeoJSONOrThrow
▸ toGeoJSONOrThrow(input
): GeoShape
Parameters
Name | Type |
---|---|
input | unknown |
Returns
GeoShape
Defined in
tzCacheLoaded
▸ tzCacheLoaded(): boolean
Returns
boolean
Defined in
validateListCoords
▸ validateListCoords(coords
): any
[]
Parameters
Name | Type |
---|---|
coords | CoordinateTuple [] |
Returns
any
[]