gpt4 book ai didi

sql-server-2008 - 将 float 纬度和经度转换为地理

转载 作者:行者123 更新时间:2023-12-04 05:08:54 26 4
gpt4 key购买 nike

如何将 float 纬度和经度值转换为地理类型值?我有@lat@lon变量。

最佳答案

附带案例说明:

CASE
WHEN ((@Latitude IS NOT NULL) AND (@Longitude IS NOT NULL))
THEN geography::Point(@Latitude, @Longitude, 4326)
ELSE NULL
END

或带有if的变体:
 DECLARE @Location geography = NULL
IF (@Latitude IS NOT NULL AND @Longitude IS NOT NULL)
SET @Location = geography::Point(@Latitude, @Longitude, 4326);

关于sql-server-2008 - 将 float 纬度和经度转换为地理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6902036/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com