webdggrid / Webdggrid
Class: Webdggrid
Constructors
new Webdggrid(_module)
private
new Webdggrid(_module
):Webdggrid
Parameters
• _module: any
Returns
Source
Properties
_module
protected
_module:any
Source
dggs
dggs:
IDGGSProps
=DEFAULT_DGGS
Source
resolution
resolution:
number
=DEFAULT_RESOLUTION
Source
Methods
_main()
_main():
any
test function
Returns
any
Memberof
WebDggrid
Source
cellAreaKM()
cellAreaKM(
resolution
):number
Parameters
• resolution: number
= DEFAULT_RESOLUTION
Returns
number
Source
cellDistKM()
cellDistKM(
resolution
):number
Parameters
• resolution: number
= DEFAULT_RESOLUTION
Returns
number
Source
geoToGeo()
geoToGeo(
coordinates
,resolution
):Position
[]
Converts a set of coordinates to the cell centroid values
Parameters
• coordinates: number
[][]
A 2d array of lng and lat values
• resolution: number
= DEFAULT_RESOLUTION
[resolution=DEFAULT_RESOLUTION] The resolution of the dggs
Returns
Position
[]
An array of dggs cell centroid coordinates
Source
geoToSequenceNum()
geoToSequenceNum(
coordinates
,resolution
):bigint
[]
Converts an array of geography coordinates to the list of the sequence numbers AKA DggId
Parameters
• coordinates: number
[][]
A 2d array of [[lng, lat]] values
• resolution: number
= DEFAULT_RESOLUTION
[resolution=DEFAULT_RESOLUTION] The dggs resolution
Returns
bigint
[]
An array of the DggIds
Source
getResolution()
getResolution():
number
Get the resolution of the current dggs
Returns
number
the current dggs resolution
Memberof
WebDggrid
Source
gridStatCLS()
gridStatCLS(
resolution
):number
Parameters
• resolution: number
= DEFAULT_RESOLUTION
Returns
number
Source
nCells()
nCells(
resolution
?):number
Parameters
• resolution?: number
= DEFAULT_RESOLUTION
Returns
number
Follow
Hi Returns the number of the cells in specific resolution
Memberof
WebDggrid
Source
sequenceNumToGeo()
sequenceNumToGeo(
sequenceNum
,resolution
):Position
[]
Convert a sequence number to the [lng,lat] of the center of the related cell
Parameters
• sequenceNum: bigint
[]
• resolution: number
= DEFAULT_RESOLUTION
[resolution=DEFAULT_RESOLUTION]
Returns
Position
[]
An array of [lng,lat]
Source
sequenceNumToGrid()
sequenceNumToGrid(
sequenceNum
,resolution
):Position
[][]
Convert an array of sequence numbers to the grid coordinates with format of [lng,lat]
. The output is an array with the same size as input sequenceNum
and it includes an array of CoordinateLike
objects.
Parameters
• sequenceNum: bigint
[]
• resolution: number
= DEFAULT_RESOLUTION
[resolution=DEFAULT_RESOLUTION]
Returns
Position
[][]
An array of [lng,lat]
Source
sequenceNumToGridFeatureCollection()
sequenceNumToGridFeatureCollection(
sequenceNum
,resolution
):FeatureCollection
<Polygon
,Object
&Object
>
Parameters
• sequenceNum: bigint
[]
• resolution: number
= DEFAULT_RESOLUTION
Returns
FeatureCollection
<Polygon
, Object
& Object
>
Source
setDggs()
setDggs(
dggs
,resolution
):void
Set the main dggs configuration
Parameters
• dggs: IDGGSProps
= DEFAULT_DGGS
A dggs object
• resolution: number
= DEFAULT_RESOLUTION
Returns
void
Source
setResolution()
setResolution(
resolution
?):void
Set the resolution of the dggs
Parameters
• resolution?: number
the resolution. It should be a valid integer
Returns
void
Memberof
WebDggrid
Source
version()
version():
string
Returns
string
The Webdggrid c++ version
Source
load()
static
load():Promise
<typeofWebdggrid
>
Compiles and instantiates the raw wasm.
INFO
In general WebAssembly compilation is disallowed on the main thread if the buffer size is larger than 4KB, hence forcing load
to be asynchronous;
Returns
Promise
<typeof Webdggrid
>
A promise to an instance of the Webdggrid class.
Source
unload()
static
unload():void
Unloades the compiled wasm instance.
Returns
void