Zoom and Center the Map

The center option centers the Map to a specific location. In addition to location formats accepted by the current provider, the center option accepts the following ones.

  • { 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 center and zoom options may be ignored in favor of displaying all markers and routes. 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