--.建立有空间数据的表
create table x
(
v int not null identity(,) primary key,
geog geography not null,
geogWKT as geog.STAsText()
) --.添加空间数据
insert into x(geog)
values(geography::Parse('POLYGON(
(-93.123 36.943,
-93.126 36.953,
-94.129 36.986,
-93.123 36.943)
)'
)
), --多边形,开始坐标和结束坐标必须相同,注意polygon中必须包含2层括号,否则报错 (geography::Parse('POINT(-93.123 36.943)')), --点坐标 (geography::Parse('LINESTRING(-93.123 36.943,
-93.126 36.953)')
) --两坐标之间的线 --.地理数据的计算
select v,
geogWKT,
geog.STDistance('POINT (-93.123 36.985)'), --距离
geog.STIntersects('POINT (-93.123 36.943)'), --是否有交集
geog.STLength(), --长度
geog.STArea(), --多边形面积
geog.STAsText() --WKT格式的坐标
from x
/*
v geogWKT (无列名) (无列名) (无列名) (无列名) (无列名)
1 POLYGON ((-93.123 36.943, -93.126 36.953, -94.129 36.986, -93.123 36.943)) 3561.29978820883 1 180244.411606998 48996227.1008911 POLYGON ((-93.123 36.943, -93.126 36.953, -94.129 36.986, -93.123 36.943))
2 POINT (-93.123 36.943) 4661.03285004629 1 0 0 POINT (-93.123 36.943)
3 LINESTRING (-93.123 36.943, -93.126 36.953) 3561.29978820883 1 1141.48450709835 0 LINESTRING (-93.123 36.943, -93.126 36.953)
*/
select * from x

最新文章

  1. xcode8插件无法使用
  2. Command /usr/bin/codesign failed with exit code 1
  3. August 23rd 2016 Week 35th Tuesday
  4. 第二百一十二天 how can I 坚持
  5. 浅谈iOS IPv6-only 新规
  6. Initializing nested object properties z
  7. linux产生静态库和动态库
  8. Mysql 配置慢查询日志(SlowQueryLog)以及使用日志分析工具
  9. 链接分析算法之:主题敏感PageRank
  10. javascript单例模式(懒汉 饿汉)
  11. 《Java从入门到放弃》JavaSE入门篇:练习——单身狗租赁系统
  12. Kilani and the Game-扩散形式的搜索
  13. django框架使用mysql报错,及两种解决方法
  14. ActiveMQ queue和topic,持久订阅和非持久订阅
  15. AngularJS $watch 性能杀手
  16. 基于docker的spark-hadoop分布式集群之一: 环境搭建
  17. Delphi取UTC时间秒
  18. TCP客户端【TcpClient】
  19. 优化iOS程序性能的25个方法
  20. Arduino 101/Genuino101使用-第一篇

热门文章

  1. c#获取今天星期几
  2. thymeleaf 局部变量、属性优先级、注释
  3. [大牛翻译系列]Hadoop(16)MapReduce 性能调优:优化数据序列化
  4. [大牛翻译系列]Hadoop(11)MapReduce 性能调优:诊断一般性能瓶颈
  5. Jquery操作Cookie取值错误的解决方法
  6. Configuration python CGI in XAMPP in win-7
  7. php判断ip黑名单程序代码
  8. 关于C语言指针中的p++与p+i
  9. opencv学习笔记(04)——ROI
  10. WPF-控件-编辑圆角TextBox