Monday, November 26, 2018

Map function

function getPosition(){
  try{
    var positionoptions = {timeout: 15000};
    frmMap.mapaddress.zoomLevel=15;
    kony.location.getCurrentPosition(successcallback, errorcallback, positionoptions);
  }catch(error)
    {
      alert("error"+error);
    }
}

function successcallback(position){
  try{
  var lat = position.coords.latitude;
  var long = position.coords.longitude; 
  var locationData = [{
           lat: lat,
       lon : long,
       image : "dest.png",
           desc: "your location",
           name: "location"
        }];
  frmMap.mapaddress.locationData = locationData;
    }catch(error)
    {
      alert("error"+error);
    }
}

function errorcallback(positionerror){
   try{
    var errorMesg = "Error code: " + positionerror.code;
    errorMesg = errorMesg  + " message: " + positionerror.message;
    alert(errorMesg);
     }catch(error)
    {
      alert("error"+error);
    }
}

0 comments:

Post a Comment