locationToLayer

Returns the layer (projected) coordinates that correspond to a geographical location.

Parameters

location Array|kendo.dataviz.map.Location

The geographic location. An array argument is assumed to be in [Latitude, Longitude] order.

zoom Number

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

Returns

kendo.geometry.Point The layer (projected) coordinates.

Example - retrieve the projected coordinates of a location (Array)

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

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

Example - retrieve the projected coordinates of a location (kendo.dataviz.map.Location)

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

    var map = $("#map").data("kendoMap");
    var loc = new kendo.dataviz.map.Location(0, 0);
    var point = map.locationToLayer(loc).round();
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(point.toString());
    // 256,256
</script>
In this article