我正在使用此插件 https://github.com/sebastianbaar/cordova-plugin-nativegeocoder 在cordova/ionic应用程序和iOS中我收到一个错误,指出我需要提供坐标为double。将经度和纬度值(小数)转换为双倍
该文档清楚地说明了这一点,但是因为我使用https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-geolocation/获取ios上的经度和纬度,这些数据以小数形式返回并且相当长,不知道如何在javascript中执行此操作。我一直在这里搜索,即:https://stackoverflow.com/search?q=double+latitude+and+longitude但这些答案都没有清楚或在JavaScript/angularjs中。这里是我如何获得坐标的代码。
$cordovaGeolocation.getCurrentPosition().then(function (position) {
var lat = position.coords.latitude
var long = position.coords.longitude
感谢
是*纬度*和*长*字符串?也许你只需要'+ position.coords.latitude'将值强制为数字。 Javascript没有float,integer等类型,它只有[* Number *](http://ecma-international.org/ecma-262/7.0/index.html#sec-ecmascript-language-types-数类型)。 – RobG