One of the primary features we developed into ActiveG Jayu was the ability to bookmark specific extents on the map. For those new to GIS terminology, an extent is a bounding rectangle defined by coordinate pairs, or in the case of Jayu, what you see in the browser’s viewport. With this feature, the user can bookmark an unlimited number of locations (extents) and select them whenever they’d like to return to that place on the map.
In Jayu we use Bootstrap’s btn-toolbar, btn-group, and dropdown-menu classes to create a menu with a “New Bookmark” menu item.
See Bootstrap Modals for further documentation.
After the user enters the Bookmark name (we’ll call it “Downtown”) and clicks Save, we use the ArcGIS map object’s extent property and xmin, xman, ymin, ymax to save each of the coordinates to an array.
var extent = new Array(); extent['xmin'] = esriMap.extent.xmin; extent['xmax'] = esriMap.extent.xmax; extent['ymin'] = esriMap.extent.ymin; extent['ymax'] = esriMap.extent.ymax;
var spatialReference = esriMap.spatialReference; var extent = new esri.geometry.Extent(xMin, yMin, xMax, yMax, sr); esriMap.setExtent(extent, true);
This code will set a new extent for the map, and viola, move the user to the saved location!