Zoom and Center the Map

The center option centers the Map on a specific location. The center option accepts the following location formats in addition to the formats the current provider accepts:

  • { lat: 40.749825, lng: -73.987963 }
  • "40.749825, -73.987963"
  • [ 40.749825, -73.987963 ]
  • "Brooklyn Bridge,New York,NY"

To zoom the Map, set the zoom option. The lower the value, the larger the displayed area.

HTML
JavaScript
<div id="mapContainer"></div>
$(function() {
    $("#mapContainer").dxMap({
        center: { lat: 40.749825, lng: -73.987963 },
        zoom: 10
    });
});

Note that the widget can automatically change the center and zoom options to display all markers and routes and align them with the widget's center. To disable this behavior, assign false to the autoAdjust option.

JavaScript
$(function() {
    $("#mapContainer").dxMap({
        center: { lat: 40.749825, lng: -73.987963 },
        zoom: 7,
        markers: [
            { location: "42.743244, -71.594375" },
            { location: "37.058435, -74.903842" }
        ],
        autoAdjust: false
    });
});
See Also