Go To Event
The go-to
event provides a mechanism to dynamically and programmatically go to a specific location based on various targets (feature(s), latitude/longitude, geometry, etc.).
See the MapView's goTo method docs for additional details on the accepted payload of this event.
Properties
Property | Required | Type | Summary | |
---|---|---|---|---|
target | No | object | The target property accepts various objects to zoom to (see docs) | |
center | No | number[] | A center point to go to (ordered as x, y) | |
zoom | No | number | A zoom level to zoom to | |
scale | No | number | A scale to set | |
options | No | object | Options to apply on the action (see docs) |
Examples
Go to a latitude/longitude point
postMessage(
{
source: 'SAM',
eventName: 'go-to',
data: {
target: {
latitude: -42,
longitude: -72
}
}
},
'*'
);
Go to a coordinate/point
postMessage(
{
source: 'SAM',
eventName: 'go-to',
data: {
target: {
x: -8643838,
y: 4908905,
spatialReference: { latestWkid: 3857, wkid: 102100 }
}
}
},
'*'
);
Go to a center location
postMessage(
{
source: 'SAM',
eventName: 'go-to',
data: {
center: [-126, 49]
}
},
'*'
);
Go to a center location w/ zoom
postMessage(
{
source: 'SAM',
eventName: 'go-to',
data: {
center: [-126, 49],
zoom: 15
}
},
'*'
);
Go to a polygon
See Polygon docs for the ArcGIS JavaScript API.
postMessage(
{
source: 'SAM',
eventName: 'go-to',
data: {
target: {
rings: [
[
[-97.06138, 32.837, 35.1, 4.8],
[-97.06133, 32.836, 35.2, 4.1],
[-97.06124, 32.834, 35.3, 4.2],
[-97.06138, 32.837, 35.1, 4.8]
],
[
[-97.06326, 32.759, 35.4],
[-97.06298, 32.755, 35.5],
[-97.06153, 32.749, 35.6],
[-97.06326, 32.759, 35.4]
]
]
}
}
},
'*'
);
Go to a line
See Polyline docs for the ArcGIS JavaScript API.
postMessage(
{
source: 'SAM',
eventName: 'go-to',
data: {
target: {
paths: [
[
[-97.06138, 32.837, 5],
[-97.06133, 32.836, 6],
[-97.06124, 32.834, 7]
]
]
}
}
},
'*'
);
Go to a viewpoint
See Viewpoint docs for the ArcGIS JavaScript API.
postMessage(
{
source: 'SAM',
eventName: 'go-to',
data: {
target: {
rotation: 16.112761131793995,
scale: 18055.954822,
targetGeometry: {
spatialReference: { latestWkid: 3857, wkid: 102100 },
x: -10826668.257178396,
y: 3862968.1260289485
}
}
}
},
'*'
);