Sample input ::
FieldValue = 51.467696956223364, -0.1153564453125;
function GetStringCoordinate (FieldValue) {
if (FieldValue != null && FieldValue != undefined && FieldValue != '') {
var coordinateArray = FieldValue.split(',');
if (coordinateArray.length == 2) {
var latFloat = parseFloat(coordinateArray[0]);
var lngFloat = parseFloat(coordinateArray[1]);
//latitude formatting
var latCh = coordinateArray[0] > 0 ? 'N' : 'S';
var latD = Math.trunc(coordinateArray[0]);
var latM = Math.trunc(coordinateArray[0] * 60 % 60)
var latS = Math.trunc((Math.abs(coordinateArray[0]) * 3600) % 60)
var latStr = latD + "° " + latM + "′ " + latS + "″ " + latCh;
//longitude formatting
var lngCh = coordinateArray[1] > 0 ? 'E' : 'W';
var lngD = Math.trunc(coordinateArray[1]);
var lngM = Math.trunc(coordinateArray[1] * 60 % 60)
var lngS = Math.trunc((Math.abs(coordinateArray[1]) * 3600) % 60)
var lngStr = lngD + "° " + lngM + "′ " + lngS + "″ " + lngCh;
}
return latStr + ', ' + lngStr;
}
return '';
};
Windows 7, Linux, Mac, JavaScript, jQuery, ExtJs, Angular, .NET, Java, Android, iOS, php, mysql, lucene and more...
Subscribe to:
Post Comments (Atom)
-
I'm using following code part to access a ReST API. I'm communicating with this API using a X509 client certificate. In d...
-
Recently I purchased nord-vpn for testing. But I could not use their service due to a technical reason. So I wanted to cancel and get my mo...
-
I noticed that all events of root/home page isn't working after I have navigated back in my ionic 4 app. So if you using a back butto...
Thanks for sharing...
ReplyDeleteAngularjs developer
You welcome emma..
Delete