Skip to main content

Video fusion layer (GeoVideoLayer)

method

addVideoCameras

Add a virtual camera corresponding to the video according to the camera parameters. Obtaining camera parameters requires relying on video calibration tools. For details, please contact customer service (lower right corner).

Parameters

NameTypeDescription
cameraDataObject/Array[Object]RequiredCamera parameter object or object group that needs to be added.
nametypedefault valuedescription
videoUrlStringRequiredCamera resource file path.
farNumberRequiredFar plane, the value is a positive number, and near < far.
fovNumberRequiredField of view angle, radian value, range: (0, π).
headingNumberRequiredCamera azimuth angle, radian value, range: [-π, π].
widthNumberRequiredVideo width, the value is a positive number.
heightNumberRequiredVideo height, the value is a positive number.
nameStringRequiredCamera name.
nearNumberRequiredNear plane, the value is a positive number.
pitchNumberRequiredCamera pitch angle, radian value, range: [0, π].
positionArrayRequiredCamera position information, three-dimensional array, such as [x, y, z].
rollNumberRequiredCamera roll angle, radian value, range: [-π, π].
aspectNumberwidth/heightoptionalCamera aspect ratio, the value is a positive number.
maskBoxArray[Number][0,1,0,1]optionalCrop the video frame range. Array representation: [xMin, xMax, yMin, yMax], the starting point is the lower left corner, xMin, xMax represent the starting point proportion and end point proportion of the video horizontal cropping, yMin, yMax represent the starting point proportion and end point proportion of the video vertical direction cropping, the parameter value range is 0-1, and xMin < xMax, yMin < yMax.
cameraModelNumber0optionalDistortion correction type, 0 means no distortion correction, 1 means fisheye distortion correction, 12 means division model distortion correction.
depthTestBooleantrueoptionalWhether to enable depth testing.
factorNumber0optionalFactor, the value is an integer greater than or equal to 0.
fxNumber0optionalDistortion correction parameter, value is greater than 0.
fyNumber0optionalDistortion correction parameter, value is greater than 0.
k1Number0optionalDistortion correction parameter, the value is a rational number.
k2Number0optionalDistortion correction parameter, the value is a rational number.
k3Number0optionalDistortion correction parameter, the value is a rational number.
k4Number0optionalDistortion correction parameter, the value is a rational number.
p1Number0optionalDistortion correction parameter, the value is a rational number.
p2Number0optionalDistortion correction parameter, the value is a rational number.
unitsNumber0optionalUnit, the value is an integer greater than or equal to 0.
u0NumberoptionalDistortion correction parameter, value is greater than 0.
videoTypeNumber1optionalVideo source format, 0 means mp4 format, 1 means img, 2 means flv.
v0NumberoptionalDistortion correction parameter, value is greater than 0.
zThresholdNumber0optionalz offset, value is greater than or equal to 0.
limitHeightNumberundefinedoptionalCrop the projected video according to the specified height in the three-dimensional space. The default is not to crop, and the value is greater than or equal to 0.
fScaleNumber1optionalView scaling coefficient, the value is a positive number, the default is 1, no scaling, when it is less than 1, the viewing angle increases, when it is greater than 1, the viewing angle decreases.
cropRangeArray[]optionalThe cropping range array of the video screen, retaining the video content within the cropping range, with the lower left corner of the video screen as the coordinate origin [0,0], the X axis is positive to the right, the Y axis is positive upward, the value range is 0-1, and the upper right corner is [1,1].
colorBalanceArray[]optional3×4 color correction matrix used for color uniformity, represented by a two-dimensional array, in the shape of [ [ a1, a2, a3, a4], [b1, b2, b3, b4], [c1, c2, c3, c4]].

getViewPoint

Get the view point of the current window. The return value can be used in the setViewPoint interface.

setVideoCameraActiveByIndex

Set the camera to start based on the index.

Parameters

NameTypeDescription
activeBooleanRequiredSet the opening and hiding of the camera screen, true means opening.
indexNumberRequiredCamera index sequence.
Case
        let models_geo = ["ATModelNew.glb"].map(item => ({
type: 'glb',
url: "../example_data/aoti_models/" + item
}));
let options = {
id: 'model_id1',
type: 'geoVideo',
models: models_geo,
center: [120.744471002000068, 31.306768408000039, 3.617],
project: "3857",
cameraData: cameraData,
callback: function (geoVideo) {
GeoVideo = geoVideo;
}
}
map.addLayer(options);

map.on('click', function (e) {
GeoVideo.setVideoCameraActiveByIndex(0, true);
GeoVideo.setViewPoint(viewData)
})

Refer to Example.

setViewPoint

Set the map viewshed based on viewpoint information.

Parameters

NameTypeDescription
viewDataObjectRequiredViewpoint information object.
nametypedefault valuedescription
headingNumberRequiredView point azimuth angle radian value, range: [-π, π].
pitchNumberRequiredView point pitch angle, radian value, range: [0, π].
positionArrayRequiredViewpoint position information, three-dimensional array, such as [x, y, z].
rollNumberRequiredView point roll angle, radian value, range: [-π, π].
isLLHBooleanfalseoptionalWhether the viewpoint position is expressed in longitude and latitude, true indicates longitude and latitude.

setCropRangeByIndex

Set the cropping range of the video screen according to the index. For details, please refer to Example.

Parameters

nametypedefault valuedescription
indexNumberRequiredCamera index sequence.
cropRangeArray[]optionalThe crop range array of the video screen, retaining the video content within the crop range, with the lower left corner of the video screen as the coordinate origin [0,0], the X axis is positive to the right, the Y axis is positive upward, the value range is 0-1, and the upper right corner is [1,1].

Case

let options = {
id: 'model_id1',
type: 'geoVideo',
cameraData: [{...},{...},...],
callback: function (geoVideo) {
GeoVideo = geoVideo;
}
}
map.addLayer(options);
//Set the cropping range of the first video
GeoVideo.setCropRangeByIndex(0, [[0.1,0.1],[0.8,0.1],[0.8,0.8],[0.1,0.8]]);

setColorBalanceByIndex

Set the color correction matrix of the video image according to the index. For details, please refer to Example.

Parameters

nametypedefault valuedescription
indexNumberRequiredCamera index sequence.
colorBalanceArray[]optionalA 3×4 color correction matrix for color balancing, represented by a two-dimensional array, in the shape of [ [ a1, a2, a3, a4], [b1, b2, b3, b4], [c1, c2, c3, c4]]. By default, an empty array means no color balancing is performed.

Case

let options = {
id: 'model_id1',
type: 'geoVideo',
cameraData: [{...},{...},...],
callback: function (geoVideo) {
GeoVideo = geoVideo;
}
}
map.addLayer(options);
//Set the color correction matrix of the first video
GeoVideo.setColorBalanceByIndex(0, [[0.5,0.5,0.5,0.5],[0.5,0.5,0.5,0.5],[0.5,0.5,0.5,0.5]]);