How To Zoom in on a Feature in the Map
Use the features and reveal APIs to have the map viewer center and zoom in on a feature in the map.
<html>
<head>
<script type="text/javascript" src="map_data/swfobject.js"></script>
<script type="text/javascript" src="map_data/avenza.js"></script>
<script type="text/javascript">
var theMap = AVENZA.embedViewer("map", "750", "500",
{
baseURL:"map_data/",
flashSecuritySandbox: AVENZA.AUTO_SANDBOX
}
);
function texas() {
theMap.features('STATE_ABBR="TX"').reveal();
}
function est() {
theMap.features('TIMEZONE="EST"').reveal();
}
</script>
</head>
<body>
<div style="position:relative">
<div id="map">
</div>
<hr>
<button type="button" onclick="texas()">Zoom in on Texas</button>
<button type="button" onclick="est()">Zoom in on States in Eastern Time</button>
</div>
</body>
</html>
If more than one feature matches the expression, the view will zoom to fit all of them. You can see live example here.
