Controls are a way to encapsulate functionality on a map. The following types of controls are currently available in this release:
- Large Zoom Control
- Small Zoom Control
- View Control
- Traffic Control
- Inset Map Control
- Geolocation Control
- Geolocation Control using jQuery and Reverse Geocoding Service
Large Zoom Control
Small Zoom Control
NOTE: The View Control can only be placed on the top right corner of the map.
NOTE: The Traffic Control can only be placed on the top right corner of the map.
Inset Map Control
NOTE: The Inset Map Control currently only supports being placed on the bottom right corner of the map.
MQA.InsetMapControl can provide users with a better idea of location by displaying the current view in context of a larger geographical area. You can customize the look and feel of the map using CSS for coloring and/or passing the optional configuration into the constructor of the control to provide size, zoom differential and mapType.
The code below will produce a map with the GeolocationControl, which allows the user to easily center the map to their current location. This location can be based on IP address information, WiFi connection, cell information or GPS. It is completely opt-in for the user, who gets to choose whether to share their location. The MapQuest GeolocationControl is built on top of support for the W3C Geolocation Specification implemented in many of the latest browsers. Geolocation is often associated with HTML 5, although it is not technically part of HTML 5.
Geolocation Control using jQuery and Reverse Geocoding Service
You can also download multiple modules at the same time, allowing you to easily add several map controls. See the Adding Basic Controls sample to learn how to add a standard set of controls.