UI Widgets Map

An interactive map widget.

Included in: dx.phonejs.js, dx.webappjs.js, dx.all.js

The dxMap widget is an interactive map widget, which displays the map at a specified location using a specified zoom level. It also enables you to add markers and routes.

You can create a widget using one of the following approaches.

  • jQuery
    Use the dxMap jQuery plug-in.

    HTML
    <div id="map"></div>
    JavaScript
    $("#map").dxMap({
        provider: 'bing',
        type: 'roadmap',
        zoom: 10,
        center: "40.749825, -73.987963"
    });
  • Knockout
    Add a div element and apply the dxMap binding to this element.

    HTML
    <div data-bind="dxMap: {
        provider: 'bing',
        type: 'roadmap',
        zoom: 10,
        center: '40.749825, -73.987963'
    }"></div>
  • Angular
    Add a div element and apply the dx-map directive to this element.

    HTML
    <div dx-map="{
        provider: 'bing',
        type: 'roadmap',
        zoom: 10,
        center: '40.749825, -73.987963'
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required.

See Also

For detailed information on working with the dxMap widget, refer to the dxMap guide.

View Demo

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController" style="height: 100%;">
    <div dx-map="options"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.options = {
        center: "40.749825, -73.987963",
        width: "100%",
        height: "100%",
        zoom: 13,
        provider: "google",
        mapType: "satellite",
        markers: [
          { title: "A", location: [40.737102, -73.990318] },
          { title: "B", location: [40.749825, -73.987963] },
          { title: "С", location: [40.755823, -73.986397] }
        ],
        routes: [{
            weight: 5,
            color: "blue",
            locations: [
              [40.737102, -73.990318],
              [40.749825, -73.987963],
              [40.755823, -73.986397]
            ]
        }]
    };
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
<div data-bind="dxMap:options"></div>
var myViewModel = {
    options: {
        center: "40.749825, -73.987963",
        width: "100%",
        height: "100%",
        zoom: 13,
        provider: "google",
        mapType: "satellite",
        markers: [
          { title: "A", location: [40.737102, -73.990318] },
          { title: "B", location: [40.749825, -73.987963] },
          { title: "С", location: [40.755823, -73.986397] }
        ],
        routes: [{
            weight: 5,
            color: "blue",
            locations: [
              [40.737102, -73.990318],
              [40.749825, -73.987963],
              [40.755823, -73.986397]
            ]
        }]
    }
}
ko.applyBindings(myViewModel);
<div id="myMap"></div>
$("#myMap").dxMap({
    center: "40.749825, -73.987963",
    width: "100%",
    height: "100%",
    zoom: 13,
    provider: "google",
    mapType: "satellite",
    markers: [
        { title: "A", location: [40.737102, -73.990318] },
        { title: "B", location: [40.749825, -73.987963] },
        { title: "С", location: [40.755823, -73.986397] }
    ],
    routes: [{
        weight: 5,
        color: "blue",
        locations: [
            [40.737102, -73.990318],
            [40.749825, -73.987963],
            [40.755823, -73.986397]
        ]
    }]
});

Configuration

An object defining configuration options for the dxMap widget.

Methods

This section describes members used to manipulate a widget.

Events

This section describes events exposed by this widget.