📚API References
The Jakartowns JavaScript API enables integration of the Jakartowns digital twin into third-party web applications. The JavaScript script contains the API’s code, including all its functions and methods to manipulate the digital twin.
The API facilitates interaction with the digital twin by providing methods to set the position, rotation, tilt, and field of view of the view.
The API is applied to an HTML container within the web application page.
Once the API is retrieved, the create_jakartowns
function is available to create an instance of the Jakartowns digital twin in a specific container on the web page.
Functions to Interact with the Digital Twin
setPosition(viewer, wantedPosition: { latitude: float, longitude: float })
setPosition(viewer, wantedPosition: { latitude: float, longitude: float })
Sets the view’s position of the digital twin on the map using the specified latitude and longitude coordinates. This function returns the digital twin’s data after positioning, including the current image UID and the distance between the target position and the panorama position.
setTilt(viewer, wantedTilt: int)
setTilt(viewer, wantedTilt: int)
Sets the vertical tilt of the digital twin’s view using the specified value. This function returns the new tilt.
setPan(viewer, wantedPan: int)
setPan(viewer, wantedPan: int)
Sets the horizontal rotation of the digital twin’s view using the specified value. This function returns the new rotation.
setFov(viewer, wantedFov: int)
setFov(viewer, wantedFov: int)
Sets the field of view (FOV) of the digital twin’s view using the specified value. This function returns the new FOV value.
Events
position
position
This event is triggered when the user changes position in the digital twin. It provides the details of the new position, including latitude and longitude coordinates.
rotation
rotation
This event is triggered when the user changes the horizontal rotation of the digital twin’s view. It provides the new rotation value.
tilt
tilt
This event is triggered when the user changes the vertical tilt of the digital twin’s view. It provides the new tilt value.
fov
fov
This event is triggered when the user changes the field of view (FOV) of the digital twin’s view. It provides the new FOV value.
Last updated