Skip to main content

Geo Utils API Overview

geoHash

geoHash: object

Defined in: types/latlon-geohash/index.d.ts:34

Type Declaration

adjacent

adjacent: (geoHash, direction) => any

Parameters
ParameterType
geoHashstring
direction"N" | "S" | "E" | "W"
Returns

any

adjacent cell to given geohash in specified direction (N/S/E/W).

bounds

bounds: (geoHash) => object

Parameters
ParameterType
geoHashstring
Returns

object

bounds of given geohash.

ne

ne: number

sw

sw: number

decode

decode: (geoHash) => object

Parameters
ParameterType
geoHashstring
Returns

object

of centre of given geohash, to appropriate precision.

lat

lat: number

lon

lon: number

encode

encode: (lat, lon, precision?) => string

encode latitude/longitude point to geohash of given precision (number of characters in resulting geohash); if precision is not specified, it is inferred from precision of latitude/longitude values.

Parameters
ParameterType
latnumber
lonnumber
precision?number
Returns

string

neighbours

neighbours: (geoHash) => object

Parameters
ParameterType
geoHashstring
Returns

object

all 8 adjacent cells (n/ne/e/se/s/sw/w/nw) to given geohash.

n

n: number

ne

ne: number

nw

nw: number

s

s: number

se

se: number

sw

sw: number

w

w: number


geoJSONTypes

const geoJSONTypes: string[]

Defined in: packages/geo-utils/src/index.ts:54

Functions

createValidGeoBox()

createValidGeoBox(topLeft, bottomRight): Feature<Polygon, GeoJsonProperties>

Defined in: packages/geo-utils/src/index.ts:199

Parameters

ParameterType
topLeftGeoPoint
bottomRightGeoPoint

Returns

Feature<Polygon, GeoJsonProperties>


geoContains()

geoContains(firstGeoEntity, secondGeoEntity): boolean

Defined in: packages/geo-utils/src/index.ts:357

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

ParameterType
firstGeoEntityGeoInput
secondGeoEntityGeoInput

Returns

boolean


geoContainsFP()

geoContainsFP(queryGeoEntity): (input) => boolean

Defined in: packages/geo-utils/src/index.ts:365

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

ParameterType
queryGeoEntityGeoInput

Returns

(input) => boolean


geoDisjoint()

geoDisjoint(firstGeoEntity, secondGeoEntity): boolean

Defined in: packages/geo-utils/src/index.ts:593

Returns true if both geo entities have no overlap

Parameters

ParameterType
firstGeoEntityGeoInput
secondGeoEntityGeoInput

Returns

boolean


geoDisjointFP()

geoDisjointFP(queryGeoEntity): (input) => boolean

Defined in: packages/geo-utils/src/index.ts:577

Parameters

ParameterType
queryGeoEntityGeoInput

Returns

(input) => boolean


geoIntersects()

geoIntersects(firstGeoEntity, secondGeoEntity): boolean

Defined in: packages/geo-utils/src/index.ts:558

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

ParameterType
firstGeoEntityGeoInput
secondGeoEntityGeoInput

Returns

boolean


geoIntersectsFP()

geoIntersectsFP(queryGeoEntity): (input) => boolean

Defined in: packages/geo-utils/src/index.ts:562

Parameters

ParameterType
queryGeoEntityGeoInput

Returns

(input) => boolean


geoPointWithinRange()

geoPointWithinRange(startingPoint, distanceValue, point): boolean

Defined in: packages/geo-utils/src/index.ts:272

Parameters

ParameterType
startingPointGeoPointInput
distanceValuestring
pointGeoPointInput

Returns

boolean


geoPointWithinRangeFP()

geoPointWithinRangeFP(startingPoint, distanceValue): (input) => boolean

Defined in: packages/geo-utils/src/index.ts:287

Parameters

ParameterType
startingPointGeoPointInput
distanceValuestring

Returns

(input) => boolean


geoPolyHasPoint()

geoPolyHasPoint<G>(polygon): (fieldData) => boolean

Defined in: packages/geo-utils/src/index.ts:256

Type Parameters

Type Parameter
G extends Polygon | MultiPolygon

Parameters

ParameterType
polygonG | Feature<G, GeoJsonProperties>

Returns

(fieldData) => boolean


geoRelationFP()

geoRelationFP(geoShape, relation): (input) => boolean

Defined in: packages/geo-utils/src/index.ts:302

Parameters

ParameterType
geoShapeGeoInput
relationGeoShapeRelation

Returns

(input) => boolean


geoWithin()

geoWithin(firstGeoEntity, secondGeoEntity): boolean

Defined in: packages/geo-utils/src/index.ts:491

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

ParameterType
firstGeoEntityGeoInput
secondGeoEntityGeoInput

Returns

boolean


geoWithinFP()

geoWithinFP(queryGeoEntity): (input) => boolean

Defined in: packages/geo-utils/src/index.ts:499

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

ParameterType
queryGeoEntityGeoInput

Returns

(input) => boolean


inGeoBoundingBox()

inGeoBoundingBox(top_left, bottom_right, point): boolean

Defined in: packages/geo-utils/src/index.ts:223

Parameters

ParameterType
top_leftGeoPointInput
bottom_rightGeoPointInput
pointGeoPointInput

Returns

boolean


inGeoBoundingBoxFP()

inGeoBoundingBoxFP(top_left, bottom_right): (input) => boolean

Defined in: packages/geo-utils/src/index.ts:230

Parameters

ParameterType
top_leftGeoPointInput
bottom_rightGeoPointInput

Returns

(input) => boolean


isGeoJSON()

isGeoJSON(input): input is GeoShape | ESGeoShape

Defined in: packages/geo-utils/src/index.ts:59

Parameters

ParameterType
inputunknown

Returns

input is GeoShape | ESGeoShape


isGeoPoint()

isGeoPoint(input): boolean

Defined in: packages/geo-utils/src/index.ts:195

Parameters

ParameterType
inputunknown

Returns

boolean


isGeoShapeMultiPolygon()

isGeoShapeMultiPolygon(input): input is GeoShapeMultiPolygon

Defined in: packages/geo-utils/src/index.ts:78

Parameters

ParameterType
inputunknown

Returns

input is GeoShapeMultiPolygon


isGeoShapePoint()

isGeoShapePoint(input): input is GeoShapePoint

Defined in: packages/geo-utils/src/index.ts:68

Parameters

ParameterType
inputunknown

Returns

input is GeoShapePoint


isGeoShapePolygon()

isGeoShapePolygon(input): input is GeoShapePolygon

Defined in: packages/geo-utils/src/index.ts:73

Parameters

ParameterType
inputunknown

Returns

input is GeoShapePolygon


lookupTimezone()

lookupTimezone(input): string

Defined in: packages/geo-utils/src/index.ts:674

Takes in a geo point like entity and returns the timezone of its location

Parameters

ParameterType
inputunknown

Returns

string


makeCoordinatesFromGeoPoint()

makeCoordinatesFromGeoPoint(point): CoordinateTuple

Defined in: packages/geo-utils/src/index.ts:252

Parameters

ParameterType
pointGeoPoint

Returns

CoordinateTuple


makeGeoCircle()

makeGeoCircle(point, distance, unitVal?): Feature<Polygon, GeoJsonProperties> | undefined

Defined in: packages/geo-utils/src/index.ts:264

Parameters

ParameterType
pointGeoPoint
distancenumber
unitVal?GeoDistanceUnit

Returns

Feature<Polygon, GeoJsonProperties> | undefined


makeGeoFeature()

makeGeoFeature(geoShape): Feature<any, GeoJsonProperties> | undefined

Defined in: packages/geo-utils/src/index.ts:325

Converts a geoJSON object to its turf geo feature counterpart

Parameters

ParameterType
geoShapeunknown

Returns

Feature<any, GeoJsonProperties> | undefined


makeGeoFeatureOrThrow()

makeGeoFeatureOrThrow(geoShape): Feature<any>

Defined in: packages/geo-utils/src/index.ts:342

Converts a geoJSON object to its turf geo feature counterpart, will throw if not valid

Parameters

ParameterType
geoShapeunknown

Returns

Feature<any>


parseGeoDistance()

parseGeoDistance(str): GeoDistanceObj

Defined in: packages/geo-utils/src/index.ts:83

Parameters

ParameterType
strstring

Returns

GeoDistanceObj


parseGeoDistanceUnit()

parseGeoDistanceUnit(input): GeoDistanceUnit

Defined in: packages/geo-utils/src/index.ts:96

Parameters

ParameterType
inputstring

Returns

GeoDistanceUnit


parseGeoPoint()

Call Signature

parseGeoPoint(point): GeoPoint

Defined in: packages/geo-utils/src/index.ts:153

Convert an input into a Geo Point object with lat and lon

Parameters
ParameterType
pointunknown
Returns

GeoPoint

Call Signature

parseGeoPoint(point, throwInvalid): GeoPoint

Defined in: packages/geo-utils/src/index.ts:154

Convert an input into a Geo Point object with lat and lon

Parameters
ParameterType
pointunknown
throwInvalidtrue
Returns

GeoPoint

Call Signature

parseGeoPoint(point, throwInvalid): GeoPoint | null

Defined in: packages/geo-utils/src/index.ts:155

Convert an input into a Geo Point object with lat and lon

Parameters
ParameterType
pointunknown
throwInvalidfalse
Returns

GeoPoint | null


polyHasHoles()

polyHasHoles(input): boolean

Defined in: packages/geo-utils/src/index.ts:661

Parameters

ParameterType
inputGeoShape

Returns

boolean


toGeoJSON()

toGeoJSON(input): GeoShape | undefined

Defined in: packages/geo-utils/src/index.ts:607

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

ParameterType
inputunknown

Returns

GeoShape | undefined


toGeoJSONOrThrow()

toGeoJSONOrThrow(input): GeoShape

Defined in: packages/geo-utils/src/index.ts:641

Parameters

ParameterType
inputunknown

Returns

GeoShape


tzCacheLoaded()

tzCacheLoaded(): boolean

Defined in: packages/geo-utils/src/index.ts:684

Returns

boolean


validateBoundingBox()

validateBoundingBox(top_left, bottom_right): object

Defined in: packages/geo-utils/src/index.ts:237

Parameters

ParameterType
top_leftGeoPointInput
bottom_rightGeoPointInput

Returns

object

bottomRight

bottomRight: GeoPoint

polygon

polygon: Feature<Polygon, GeoJsonProperties>

topLeft

topLeft: GeoPoint


validateListCoords()

validateListCoords(coords): any[]

Defined in: packages/geo-utils/src/index.ts:651

Parameters

ParameterType
coordsCoordinateTuple[]

Returns

any[]