google-apps-script - 谷歌表格脚本无法识别拆分功能
问题描述
这是我的代码。由于某种原因,Sheets 说“无法识别拆分功能”。
function distance3(latlon1, latlon2){
var [lat1, lon1] = split(latlon1,",");
var [lat2, lon2] = split(latlon2,",");
var R = 6371000; // radius of the earth in meters, https://en.wikipedia.org/wiki/Earth_radius
var dLat = (lat2-lat1) * Math.PI / 180; // Convert degrees to radians
var dLon = (lon2-lon1) * Math.PI / 180; // Convert degrees to radians
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(lat1 * Math.PI / 180 ) * Math.cos(lat2 * Math.PI / 180 ) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
// Distance in meters, rounded to an integer.
return Math.round(d)*0.000621371;
}
谢谢你!
解决方案
尝试:
var [lat1, lon1] = latlon1.split(",");
推荐阅读
- nosql - 有可能用键值将数据存储在 HDFS 中吗?
- java - Eclipse e4 导出 - build.xml:执行此行时出现问题:
- apache-drill - Apache Drill Kudu 查询不支持范围 + 哈希多级分区
- camunda - HTTP-CONNECTOR 之间的 Camunda-Pass 参数
- android - 无法在 Flutter 中设置 DropdownMenuItem 内的自定义列表
- json - MongoDB如何使用猫鼬模式将角色连接到用户
- c# - 读取 XML 并将其作为 C# 中的字符串列表
- excel - 为什么我在两个 Excel 表中检查一个简单的 IF 条件时得到 0
- sql - 如何将十进制时间转换为日期时间,以便我可以对其运行 dateadd 计算
- angular - 我在 Angular 7 中使用 DotNet Core web Api 得到“Http failure response for (unknown url): 0 Unknown Error”