This page is about basic interactions that occur between the Viewer and the third-party map.
In some scenario's the viewer needs the third party viewer to provide a coordinate :
This is how that process works :
onPickPositionRequested signal.Note that when providing a coordinate to the SDK, it must be provided with a CRS code.
handlePickPositionRequested() { // Set a flag waitingForPickPosition = true; // Request the click from the user... } handleUserPickedPosition(x,y,crs) { // Pass position to the viewer let coordinate = Coordinate.fromXY(crs,x,y); viewer.setPickPosition(coordinate); } viewer.onPickPositionRequested.add(handlePickPositionRequested);
One simple function exists to focus the viewer on a coordinate. When called, the viewer will ask all views to focus on the given coordinate :
var coordinate = Coordinate.fromXY("4326",longitude,latitude); viewer.setFocusPosition(coordinate);
Zooming to a specific extent is something the user can request from inside the Viewer. One example is zooming to a resource extent. It is up to you as an SDK developer to implement this action.
The provided extent will always be expressed in the default crs.
function handleZoomToExtent(extent) { // Zoom third-party viewer to the given extent. // ... } // Listen to event. viewer.onZoomToExtent.add(handleZoomToExtent);