• postgis的geography_columns和geometry_columns有什么区别


    1、先说说Sql Server中geometry和geography的区别:

            geometry:planar    平面坐标系【supported by SQL Server conforms to the Open Geospatial Consortium (OGC) Simple Features for SQL Specification version 1.1.0.】

            geography: terrestrial   地理坐标系【stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates.】

            如果要计算两个lat/lon点之间的实际距离就需要将geometry类型转成geography类型,不然结果肯定不正确。

    2、geometry转geography的方法:

           geography::STGeomFromText(boundary.ToString(), 4326)

           boundary是geometry类型的,4326是坐标系的参数,4326代表GCS-WGS-1984坐标系,是系统默认的坐标系。

           可以通过这个sql获得系统的坐标系(Sql server中):Select * from sys.spatial_reference_systems where authorized_spatial_reference_id=4326

    3、STDistance的用法:

           https://msdn.microsoft.com/zh-cn/library/bb933952(v=sql.110).aspx

           按照里面的例子能够计算出距离,但是如果输入的是经纬度的值,得出的结果总是觉得不对,值比较小,实际上需要按照第二步转化为geography类型再计算就可以了,4326坐标系默认返回距离的单位【unit】是米【meter】。

           STDistance也可以计算点到面的最短距离。   

    不积跬步无以至千里,不积小流无以成江海
  • 相关阅读:
    微软一站式示例代码浏览器 v5.1 更新
    Developers’ Musthave: the new Microsoft AllInOne Code Framework Sample Browser and 3500+ samples
    栈溢出攻击 [转]
    深入浅出Java的访问者模式 [转]
    优先级反转 [转]
    latex 引用section [转]
    linux内存管理浅析 [转]
    静态,动态,强类型,弱类型 [转]
    linux硬链接与软链接 [转]
    GCC __attribute__ 详解 [转]
  • 原文地址:https://www.cnblogs.com/YuyuanNo1/p/13488753.html
Copyright © 2020-2023  润新知