小编Ame*_*iny的帖子

将坐标分为longtitue和latitude

我的数据库中的坐标存储为(55.573012889640765,9.72362365248182).我想创建一个能得到这个值的函数并将它们放在@latitude = 55.573012889640765和@long = 9.72362365248182上.

所以实际上函数获取坐标并分别返回两点.我想得到这个,所以我可以用以下函数计算两点之间的距离:

CREATE FUNCTION dbo.fnCalcDistanceKM(@lat1 FLOAT, @lon1 FLOAT, @lat2 FLOAT, @lon2 FLOAT)
RETURNS FLOAT 
AS
BEGIN

    RETURN ACOS(SIN(PI()*@lat1/180.0)*SIN(PI()*@lat2/180.0)+COS(PI()*@lat1/180.0)*COS(PI()*@lat2/180.0)*COS(PI()*@lon2/180.0-PI()*@lon1/180.0))*6371
END
Run Code Online (Sandbox Code Playgroud)

如您所见,此功能需要分离点,在我的数据库中,我将它们作为一个.你能告诉我如何分割部件或修改上述功能以适应我的代码.

先感谢您

sql-server function coordinates

1
推荐指数
1
解决办法
485
查看次数

What it is the jQuery equivalent function of Javascript DafaultValue()

I want to get the default value of an input textbox when the page was loaded. As I searched around I saw that the DefaultValue() is a method to get a value from a textbox when is loaded . But what is the jQuery one?

<input id=text > </input>

<script>
$(#text).DefaultValue(); // This is wrong I need the Jquery function of this
</script>
Run Code Online (Sandbox Code Playgroud)

Any Idea?

javascript jquery

0
推荐指数
1
解决办法
44
查看次数

标签 统计

coordinates ×1

function ×1

javascript ×1

jquery ×1

sql-server ×1