require(["esri/layers/orientedImagery/transformations/worldToImage"], (worldToImage) => { /* code goes here */ });
import * as worldToImage from "@arcgis/core/layers/orientedImagery/transformations/worldToImage.js";
esri/layers/orientedImagery/transformations/worldToImage
Provides the utility function to convert geographic coordinates to image coordinates. This function is currently utilized in the Oriented Imagery widget to extract image coordinates for the map-image location tool and for constructing the current footprint generated for the images displayed in the oriented imagery widget.
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Transforms a point or an array of points from geographic world coordinates to image space coordinates. | worldToImage |
Method Details
-
worldToImage
worldToImage(pointOrPoints, properties){PixelLocation |PixelLocation[]}
-
Transforms a point or an array of points from geographic world coordinates to image space coordinates. The function supports both single points and collections of points.
ParameterspointOrPoints Point|Point[]|Collection<Point>A single
Point
or an array or collection of points representing the geographic coordinates to be transformed.properties WorldToImagePropertiesAn object containing the properties required for the transformation, such as camera location (selected feature), affineTransformations, rotation matrix, focalLength, imageHeight, imageWidth, horizontalFieldOfView and verticalFieldOfView.
ReturnsType Description PixelLocation | PixelLocation[] A LocationInImageSpace
which is an object withx
andy
properties representing the image coordinates (in rows and columns), where (0, 0) corresponds to the center of the upper left pixel. This function returns aLocationInImageSpace
object if a single point is provided, or an array ofLocationInImageSpace
objects if a collection of points is provided.Exampleconst point = new Point({ x: -13045967.713, y: 4036342.97, z: 0, spatialReference: SpatialReference.WebMercator, }); const properties = { affineTransformations: [2015.5, 1, 0, 1511.5, 0, -1], cameraLocation: new Point({ x: -13045995.27, y: 4036379.178, z: 1.549999952, spatialReference: SpatialReference.WebMercator, }), horizontalFieldOfView: 65.47045135, imageHeight: 3024, imageWidth: 4032, rotationMatrix: [ -0.6710996455056446, 4.539564596921633e-17, -0.7413671599161904, -0.7413671599161904, -4.1093001638870556e-17, 0.6710996455056446, 0, 1, 6.123233995736766e-17 ], verticalFieldOfView: 46.39718246, }; const imageLocation = worldToImage(point, properties); console.log(imageLocation);
Type Definitions
-
Represents the pixel location in image space, where (0, 0) corresponds to the center of the upper left pixel.
-
Represents the properties required for transforming world coordinates to image coordinates. For more information on the properties, please refer to the Oriented Imagery table.
- Properties
-
A fixed length array of 6 numbers corresponding to the camera affine values A0, A1, A2, B0, B1, B2. The coefficient of the affine transformation establishes a relationship between the sensor space and image space. The direction is from ground to image. A0, A1, and A2 represent the translation in x direction, while B0, B1, and B2 represent the translation in y direction. Please refer to the Oriented Imagery table for more information on the afffine values.
cameraLocation PointA Point representing the camera location in world coordinates where the image was captured.
focalLength NumberThe focal length of the camera lens. The unit can be microns, millimeters, or pixels. This parameter is used if ImageWidth and ImageHeight are not provided.
optional A fixed length array of 2 numbers specifying the x-coordinate and y-coordinate of the principal point of the autocollimation. The units must be the same as the unit used for FocalLength. The default value is [0,0]. This is an optional parameter.
optional The radial distortion is specified as an array of three numbers, indicating [K1,K2,K3] coefficient values. The coupling unit is the same as the unit specified for FocalLength. The default value is [0,0,0]. This is an optional parameter.
The row-wise sorted rotation matrix that defines the transformation from image space to map space, specified as an array of nine floating-point values.
optional The tangential distortion is specified as an array of three numbers, indicating [P1,P2] coefficient values. The coupling unit is the same as the unit used for FocalLength. The default value is [0,0]. This is an optional parameter.
horizontalFieldOfView NumberThe camera’s field-of-view in a horizontal direction. The unit is degrees. The valid values range from 0 through 360.
verticalFieldOfView NumberThe camera’s field-of-view in the vertical direction. The unit is degrees. The valid values range from 0 through 180.
imageHeight NumberHeight of the image used for world to image transformation, in pixels. This parameter is used if the focal length is not provided.
imageWidth Numberimage used for world to image transformation, in pixels. This parameter is used if the focal length is not provided.