UI Widgets Map

An interactive map widget.

Included in: dx.mobile.js, dx.web.js, dx.viz-web.js, dx.all.js
Module: ui/map
Map interactive configuration
Copy code
$("#map").dxMap({
});

The Map 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>
  • AngularJS
    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 library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the Installation article.

For detailed information on working with the Map 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 Map widget.

Methods

This section describes members used to manipulate a widget.

Events

This section describes events fired by this widget.