【发布时间】:2015-11-29 06:57:40
【问题描述】:
我在 MSSQL 数据库中添加了代表 map.As 中路线的行,
update route
set locationArray=geography::STGeomFromText('LINESTRING(7.068419558716859 80.140939950943,7.070868430303301 80.14106869697571,7.072976578922316 80.14136910438538,7.074339417352194 80.14203429222107,7.07631978477513 80.14278531074524,7.078491790888004 80.14435172080994,7.078300143701023 80.14649748802185,7.078449202631107 80.14877200126648,7.076617903866453 80.15068173408508,7.074978246481405 80.15248417854309,7.074105179783337 80.15490889549255,7.0723803358444135 80.15643239021301)', 4326)
where routeID=45;
现在我选择了线上的两个点,我想计算这两条线之间的距离(不是直接距离或位移),类似于图像。
我尝试了 STLength() 函数和 STDistance() 函数。但它们都提供直接距离。有人可以帮我用 TSQL 计算沿线的距离吗?
【问题讨论】:
-
你的意思是计算连续点的距离并相加吗?
标签: sql-server distance geography