从点几何或地理获取 X Y 值 [英] Get X Y values from Point Geometry or Geography

查看:29
本文介绍了从点几何或地理获取 X Y 值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找与以下 mySQL 语句等效的 MSSQL:

I'm looking for the MSSQL equivalent of the following mySQL statement:

SELECT Y(location) as Lat, X(location) as Lon from myTable;

我想获取我存储为地理数据类型的地理的 X 和 Y 值.

I want to get the X and Y values of my geography I have stored as a geography data type.

我知道 STAsText(Location) as Location 会给我 WKT ... 我只需要 X 和 Y 数值.

I know STAsText(Location) as Location will give me the WKT... i just need the X and Y number values.

推荐答案

For GEOGRAPHY:

For GEOGRAPHY:

SELECT location.Lat as Lat, location.Long as Lon from myTable;

对于几何:

SELECT location.STY as Lat, location.STX as Lon from myTable;

这篇关于从点几何或地理获取 X Y 值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆