首页 > 代码库 > 经纬度 lbs 笔记
经纬度 lbs 笔记
string Lat = objRequest.HeadLat.ToString(); 纬度
string Lng = objRequest.HeadLng.ToString(); 经度
NC.BLL.VisitLogs.UpdateUserLocation(objRequest.UID, Lat, Lng);
UPDATE userinfo SET UserLocation= geography::Point({0}, {1}, 4326) WHERE uid={2}
更新经纬度
( select UserLocation from userinfo where UID=visitlog.ToUID).STDistance(visitlog.UserLocation) AS Distance
string strDistance = NC.MSSQL.VWVisitLogs.GetDistance(userInfoHobby2User.ID);
userHobby.Distance = strDistance != null ? (int)Math.Round(strDistance.ConvertDecimal(), 0) : 99999999;
string Lat = objRequest.HeadLat.ToString();
string Lng = objRequest.HeadLng.ToString();
VisitLog objVisitLog = new VisitLog();
objVisitLog.FromuID = myUserId;
objVisitLog.ToUID = UID;
objVisitLog.Cretime = System.DateTime.Now;
NC.BLL.VisitLogs.InsertVisitLog(objVisitLog, Lat, Lng);
string strsql = string.Format(" UPDATE VisitLog SET UserLocation= geography::Point({0}, {1}, 4326) WHERE id={2} ", Lat, Lng, objVisitLog.ID);
conn.ExecuteCommand(strsql);
public static void UpdateUserLocation(int UID, string Lat, string Lng)
{
using (VIPDataContext conn = new VIPDataContext(PlatformConfig.DBConnectionString))
{
string strsql = string.Format(" UPDATE userinfo SET UserLocation= geography::Point({0}, {1}, 4326) WHERE uid={2} ", Lat, Lng, UID);
conn.ExecuteCommand(strsql);
}
}
.NET资料之-根据两点经纬度计算直线距离
http://www.cnblogs.com/Lethe/p/3805702.html
baidu经纬度坐标与google经纬度坐标都转换
http://www.cnblogs.com/Lethe/p/3819814.html
/// <summary>
/// 纬度
/// </summary>
public decimal Lat { get; set; }
/// <summary>
/// 经度
/// </summary>
public decimal Lng { get; set; }
/// <summary>
/// 高德纬度
/// </summary>
public decimal ALat { get; set; }
/// <summary>
/// 高德经度
/// </summary>
public decimal ALng { get; set; }
USE [FcityDB2]
GO
SELECT [UserLocation]
,[UserLocation2]
FROM [dbo].[Table_1]
GO
118.115196,24.49956
118.152884,24.632101
118.115959,24.500226
118.155484,24.633353
UPDATE [Table_1] SET UserLocation= geography::Point(24.632101, 118.152884, 4326)
UPDATE [Table_1] SET UserLocation2= geography::Point(24.633353, 118.155484, 4326)
SELECT UserLocation.STDistance(UserLocation2) AS Distance from [Table_1]
--106.876085126272
--297.540495255538
经纬度 lbs 笔记
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。