Kendo ui 在telerik appbuilder中使用剑道ui获取经纬度
我使用下面的函数在telerik appbuilder中使用剑道ui显示地图。 如您所见,我已经为这个指定了静态纬度和经度。 请建议一些使用剑道ui获取lat long的方法。 我想将纬度和经度值传递给createMapx,y函数Kendo ui 在telerik appbuilder中使用剑道ui获取经纬度,kendo-ui,telerik-appbuilder,Kendo Ui,Telerik Appbuilder,我使用下面的函数在telerik appbuilder中使用剑道ui显示地图。 如您所见,我已经为这个指定了静态纬度和经度。 请建议一些使用剑道ui获取lat long的方法。 我想将纬度和经度值传递给createMapx,y函数 function createMap(x,y) { console.log("createmap"); // console.log("x=" + x + " " + "y=" + y); var ds = [ { "shape"
function createMap(x,y) {
console.log("createmap");
// console.log("x=" + x + " " + "y=" + y);
var ds = [
{ "shape": "green", "location": [30.667936 ,76.732688] },
];
// 30.710458600000000000 30.657762
// 76.703347099999970000 76.740835
$("#map, #addAddFav").kendoMap({
center: [30.667936, 76.732688],
zoom: 10,
layers: [{
type: "tile",
urlTemplate: "http://#= subdomain #.tile2.opencyclemap.org/transport/#= zoom #/#= x #/#= y #.png",
subdomains: ["a", "b", "c"],
attribution: "© <a href='http://osm.org/copyright'>OpenStreetMap contributors</a>." +
"Tiles courtesy of <a href='http://www.opencyclemap.org/'>Andy Allan</a>"
},
{
type: "marker",
/* dataSource: {
transport: {
read: {
url: "map/store-locations.json",
dataType: "json"
}
}
},*/
// locationField: "latlng",
// titleField: "name"
}
],
markers: ds,
click: onMapMarkerClick,
shapeClick: onShapeClick,
shapeCreated: onShapeCreated
});
}来自Apache Cordova文档:
navigator.geolocation.getCurrentPosition(onSuccess, onError);
// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
//
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}