viewToLocation

Returns the geographical location that correspond to the view (relative) coordinates.

Parameters

point Array|kendo.geometry.Point

The view coordinates. An array argument is assumed to be in x, y order.

zoom Number

Optional. Assumed zoom level. Defaults to the current zoom level.

Returns

kendo.dataviz.map.Location The geographic location that corresponds to the view coordinates.

Example - retrieve location corresponding to view center (Array)

<div id="map" style="width: 1024px; height: 1024px;"></div>
<script>
    $("#map").kendoMap({
        zoom: 3,
        center: [0, 0],
        layers: [{
            type: "tile",
            urlTemplate: "http://a.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png",
            attribution: "&copy; OpenStreetMap"
        }]
    });

    var map = $("#map").data("kendoMap");
    var loc = map.viewToLocation([512, 512]).round();
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(loc.toString());
    // 0.000000,0.000000
</script>

Example - retrieve location corresponding to view center (kendo.geometry.Point)

<div id="map" style="width: 1024px; height: 1024px;"></div>
<script>
    $("#map").kendoMap({
        zoom: 3,
        center: [0, 0],
        layers: [{
            type: "tile",
            urlTemplate: "http://a.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png",
            attribution: "&copy; OpenStreetMap"
        }]
    });

    var map = $("#map").data("kendoMap");
    var view = new kendo.geometry.Point(512, 512);
    var loc = map.viewToLocation(view).round();
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(loc.toString());
    // 0.000000,0.000000
</script>
In this article