Skip to main content

Class: MapFieldOfViewCalculator

Calculates map projection parameters for fields of view which encompass sets of geographic points.

Constructors

constructor

new MapFieldOfViewCalculator(maxIter?, rangeTolerance?): MapFieldOfViewCalculator

Constructor.

Parameters

NameTypeDefault valueDescription
maxIternumberMapFieldOfViewCalculator.DEFAULT_MAX_ITERThe maximum number of iterations to perform when calculating fields of view. Defaults to MapFieldOfViewCalculator.DEFAULT_MAX_ITER.
rangeTolerancenumberMapFieldOfViewCalculator.DEFAULT_RANGE_TOLERANCEThe error tolerance of calculated field of view ranges, as a fraction of the ideal range for each field of view. Defaults to MapFieldOfViewCalculator.DEFAULT_RANGE_TOLERANCE.

Returns

MapFieldOfViewCalculator

Defined in

src/sdk/components/map/MapFieldOfViewCalculator.ts:37

Methods

calculateFov

calculateFov(mapProjection, focus, margins, out): MapFieldOfView

Calculates a map field of view, consisting of a range and target location, which encompasses a given set of geographic points (the focus) with the smallest possible range. If there is only one point in the specified focus, then the calculated range will be equal to 0. If the specified focus contains zero points or a field of view could not be calculated, NaN will be written to the results.

Parameters

NameTypeDescription
mapProjectionMapProjectionThe projection of the map for which to calculate the field of view.
focusreadonly LatLonInterface[]An array of points comprising the focus of the field of view.
marginsReadonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>The margins around the projected map boundaries to respect, as [left, top, right, bottom] in pixels. The field of view will be calculated in order to avoid placing any points in the focus outside of the margins.
outMapFieldOfViewThe object to which to write the results.

Returns

MapFieldOfView

The calculated field of view for the specified focus.

Defined in

src/sdk/components/map/MapFieldOfViewCalculator.ts:56