locationToView
Returns the view (relative) 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.
Returns
kendo.geometry.Point
The view coordinates that correspond to a geographical location.
Retrieves the view coordinates of the map 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: "© OpenStreetMap"
}]
});
var map = $("#map").data("kendoMap");
var view = map.locationToView([0, 0]).round();
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(view.toString());
// 512,512
</script>
Retrieves the view coordinates of the map center (kendo.dataviz.map.Location)
<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: "© OpenStreetMap"
}]
});
var map = $("#map").data("kendoMap");
var loc = new kendo.dataviz.map.Location(0, 0);
var view = map.locationToView(loc).round();
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(view.toString());
// 512,512
</script>