⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 earthdistance.out

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 OUT
📖 第 1 页 / 共 2 页
字号:
----  Test earth distance functions------ first, define the datatype.  Turn off echoing so that expected file-- does not depend on contents of earthdistance.sql or cube.sql.--\set ECHO nonepsql:../cube/cube.sql:10: NOTICE:  type "cube" is not yet definedDETAIL:  Creating a shell type definition.psql:../cube/cube.sql:15: NOTICE:  argument type cube is only a shell---- The radius of the Earth we are using.--SELECT earth()::numeric(20,5);     earth     --------------- 6378168.00000(1 row)---- Convert straight line distances to great circle distances.--SELECT (pi()*earth())::numeric(20,5);    numeric     ---------------- 20037605.73216(1 row)SELECT sec_to_gc(0)::numeric(20,5); sec_to_gc -----------   0.00000(1 row)SELECT sec_to_gc(2*earth())::numeric(20,5);   sec_to_gc    ---------------- 20037605.73216(1 row)SELECT sec_to_gc(10*earth())::numeric(20,5);   sec_to_gc    ---------------- 20037605.73216(1 row)SELECT sec_to_gc(-earth())::numeric(20,5); sec_to_gc -----------   0.00000(1 row)SELECT sec_to_gc(1000)::numeric(20,5); sec_to_gc  ------------ 1000.00000(1 row)SELECT sec_to_gc(10000)::numeric(20,5);  sec_to_gc  ------------- 10000.00102(1 row)SELECT sec_to_gc(100000)::numeric(20,5);  sec_to_gc   -------------- 100001.02426(1 row)SELECT sec_to_gc(1000000)::numeric(20,5);   sec_to_gc   --------------- 1001027.07131(1 row)---- Convert great circle distances to straight line distances.--SELECT gc_to_sec(0)::numeric(20,5); gc_to_sec -----------   0.00000(1 row)SELECT gc_to_sec(sec_to_gc(2*earth()))::numeric(20,5);   gc_to_sec    ---------------- 12756336.00000(1 row)SELECT gc_to_sec(10*earth())::numeric(20,5);   gc_to_sec    ---------------- 12756336.00000(1 row)SELECT gc_to_sec(pi()*earth())::numeric(20,5);   gc_to_sec    ---------------- 12756336.00000(1 row)SELECT gc_to_sec(-1000)::numeric(20,5); gc_to_sec -----------   0.00000(1 row)SELECT gc_to_sec(1000)::numeric(20,5); gc_to_sec  ------------ 1000.00000(1 row)SELECT gc_to_sec(10000)::numeric(20,5); gc_to_sec  ------------ 9999.99898(1 row)SELECT gc_to_sec(100000)::numeric(20,5);  gc_to_sec  ------------- 99998.97577(1 row)SELECT gc_to_sec(1000000)::numeric(20,5);  gc_to_sec   -------------- 998976.08618(1 row)---- Set coordinates using latitude and longitude.-- Extract each coordinate separately so we can round them.--SELECT cube_ll_coord(ll_to_earth(0,0),1)::numeric(20,5), cube_ll_coord(ll_to_earth(0,0),2)::numeric(20,5), cube_ll_coord(ll_to_earth(0,0),3)::numeric(20,5); cube_ll_coord | cube_ll_coord | cube_ll_coord ---------------+---------------+--------------- 6378168.00000 |       0.00000 |       0.00000(1 row)SELECT cube_ll_coord(ll_to_earth(360,360),1)::numeric(20,5), cube_ll_coord(ll_to_earth(360,360),2)::numeric(20,5), cube_ll_coord(ll_to_earth(360,360),3)::numeric(20,5); cube_ll_coord | cube_ll_coord | cube_ll_coord ---------------+---------------+--------------- 6378168.00000 |       0.00000 |       0.00000(1 row)SELECT cube_ll_coord(ll_to_earth(180,180),1)::numeric(20,5), cube_ll_coord(ll_to_earth(180,180),2)::numeric(20,5), cube_ll_coord(ll_to_earth(180,180),3)::numeric(20,5); cube_ll_coord | cube_ll_coord | cube_ll_coord ---------------+---------------+--------------- 6378168.00000 |       0.00000 |       0.00000(1 row)SELECT cube_ll_coord(ll_to_earth(180,360),1)::numeric(20,5), cube_ll_coord(ll_to_earth(180,360),2)::numeric(20,5), cube_ll_coord(ll_to_earth(180,360),3)::numeric(20,5); cube_ll_coord  | cube_ll_coord | cube_ll_coord ----------------+---------------+--------------- -6378168.00000 |       0.00000 |       0.00000(1 row)SELECT cube_ll_coord(ll_to_earth(-180,-360),1)::numeric(20,5), cube_ll_coord(ll_to_earth(-180,-360),2)::numeric(20,5), cube_ll_coord(ll_to_earth(-180,-360),3)::numeric(20,5); cube_ll_coord  | cube_ll_coord | cube_ll_coord ----------------+---------------+--------------- -6378168.00000 |       0.00000 |       0.00000(1 row)SELECT cube_ll_coord(ll_to_earth(0,180),1)::numeric(20,5), cube_ll_coord(ll_to_earth(0,180),2)::numeric(20,5), cube_ll_coord(ll_to_earth(0,180),3)::numeric(20,5); cube_ll_coord  | cube_ll_coord | cube_ll_coord ----------------+---------------+--------------- -6378168.00000 |       0.00000 |       0.00000(1 row)SELECT cube_ll_coord(ll_to_earth(0,-180),1)::numeric(20,5), cube_ll_coord(ll_to_earth(0,-180),2)::numeric(20,5), cube_ll_coord(ll_to_earth(0,-180),3)::numeric(20,5); cube_ll_coord  | cube_ll_coord | cube_ll_coord ----------------+---------------+--------------- -6378168.00000 |       0.00000 |       0.00000(1 row)SELECT cube_ll_coord(ll_to_earth(90,0),1)::numeric(20,5), cube_ll_coord(ll_to_earth(90,0),2)::numeric(20,5), cube_ll_coord(ll_to_earth(90,0),3)::numeric(20,5); cube_ll_coord | cube_ll_coord | cube_ll_coord ---------------+---------------+---------------       0.00000 |       0.00000 | 6378168.00000(1 row)SELECT cube_ll_coord(ll_to_earth(90,180),1)::numeric(20,5), cube_ll_coord(ll_to_earth(90,180),2)::numeric(20,5), cube_ll_coord(ll_to_earth(90,180),3)::numeric(20,5); cube_ll_coord | cube_ll_coord | cube_ll_coord ---------------+---------------+---------------       0.00000 |       0.00000 | 6378168.00000(1 row)SELECT cube_ll_coord(ll_to_earth(-90,0),1)::numeric(20,5), cube_ll_coord(ll_to_earth(-90,0),2)::numeric(20,5), cube_ll_coord(ll_to_earth(-90,0),3)::numeric(20,5); cube_ll_coord | cube_ll_coord | cube_ll_coord  ---------------+---------------+----------------       0.00000 |       0.00000 | -6378168.00000(1 row)SELECT cube_ll_coord(ll_to_earth(-90,180),1)::numeric(20,5), cube_ll_coord(ll_to_earth(-90,180),2)::numeric(20,5), cube_ll_coord(ll_to_earth(-90,180),3)::numeric(20,5); cube_ll_coord | cube_ll_coord | cube_ll_coord  ---------------+---------------+----------------       0.00000 |       0.00000 | -6378168.00000(1 row)---- Test getting the latitude of a location.--SELECT latitude(ll_to_earth(0,0))::numeric(20,10);   latitude   -------------- 0.0000000000(1 row)SELECT latitude(ll_to_earth(45,0))::numeric(20,10);   latitude    --------------- 45.0000000000(1 row)SELECT latitude(ll_to_earth(90,0))::numeric(20,10);   latitude    --------------- 90.0000000000(1 row)SELECT latitude(ll_to_earth(-45,0))::numeric(20,10);    latitude    ---------------- -45.0000000000(1 row)SELECT latitude(ll_to_earth(-90,0))::numeric(20,10);    latitude    ---------------- -90.0000000000(1 row)SELECT latitude(ll_to_earth(0,90))::numeric(20,10);   latitude   -------------- 0.0000000000(1 row)SELECT latitude(ll_to_earth(45,90))::numeric(20,10);   latitude    --------------- 45.0000000000(1 row)SELECT latitude(ll_to_earth(90,90))::numeric(20,10);   latitude    --------------- 90.0000000000(1 row)SELECT latitude(ll_to_earth(-45,90))::numeric(20,10);    latitude    ---------------- -45.0000000000(1 row)SELECT latitude(ll_to_earth(-90,90))::numeric(20,10);    latitude    ---------------- -90.0000000000(1 row)SELECT latitude(ll_to_earth(0,180))::numeric(20,10);   latitude   -------------- 0.0000000000(1 row)SELECT latitude(ll_to_earth(45,180))::numeric(20,10);   latitude    --------------- 45.0000000000(1 row)SELECT latitude(ll_to_earth(90,180))::numeric(20,10);   latitude    --------------- 90.0000000000(1 row)SELECT latitude(ll_to_earth(-45,180))::numeric(20,10);    latitude    ---------------- -45.0000000000(1 row)SELECT latitude(ll_to_earth(-90,180))::numeric(20,10);    latitude    ---------------- -90.0000000000(1 row)SELECT latitude(ll_to_earth(0,-90))::numeric(20,10);   latitude   -------------- 0.0000000000(1 row)SELECT latitude(ll_to_earth(45,-90))::numeric(20,10);   latitude    --------------- 45.0000000000(1 row)SELECT latitude(ll_to_earth(90,-90))::numeric(20,10);   latitude    --------------- 90.0000000000(1 row)SELECT latitude(ll_to_earth(-45,-90))::numeric(20,10);    latitude    ---------------- -45.0000000000(1 row)SELECT latitude(ll_to_earth(-90,-90))::numeric(20,10);    latitude    ---------------- -90.0000000000(1 row)---- Test getting the longitude of a location.--SELECT longitude(ll_to_earth(0,0))::numeric(20,10);  longitude   -------------- 0.0000000000(1 row)SELECT longitude(ll_to_earth(45,0))::numeric(20,10);  longitude   -------------- 0.0000000000(1 row)SELECT longitude(ll_to_earth(90,0))::numeric(20,10);  longitude   -------------- 0.0000000000(1 row)SELECT longitude(ll_to_earth(-45,0))::numeric(20,10);  longitude   -------------- 0.0000000000(1 row)SELECT longitude(ll_to_earth(-90,0))::numeric(20,10);  longitude   -------------- 0.0000000000(1 row)SELECT longitude(ll_to_earth(0,90))::numeric(20,10);   longitude   --------------- 90.0000000000(1 row)SELECT longitude(ll_to_earth(45,90))::numeric(20,10);   longitude   --------------- 90.0000000000(1 row)SELECT longitude(ll_to_earth(90,90))::numeric(20,10);   longitude   --------------- 90.0000000000(1 row)SELECT longitude(ll_to_earth(-45,90))::numeric(20,10);   longitude   --------------- 90.0000000000(1 row)SELECT longitude(ll_to_earth(-90,90))::numeric(20,10);   longitude   --------------- 90.0000000000(1 row)SELECT longitude(ll_to_earth(0,180))::numeric(20,10);   longitude    ---------------- 180.0000000000(1 row)SELECT longitude(ll_to_earth(45,180))::numeric(20,10);   longitude    ---------------- 180.0000000000(1 row)SELECT longitude(ll_to_earth(90,180))::numeric(20,10);   longitude    ---------------- 180.0000000000(1 row)SELECT longitude(ll_to_earth(-45,180))::numeric(20,10);   longitude    ---------------- 180.0000000000(1 row)SELECT longitude(ll_to_earth(-90,180))::numeric(20,10);   longitude    ---------------- 180.0000000000(1 row)SELECT longitude(ll_to_earth(0,-90))::numeric(20,10);   longitude    ---------------- -90.0000000000(1 row)SELECT longitude(ll_to_earth(45,-90))::numeric(20,10);   longitude    ---------------- -90.0000000000(1 row)SELECT longitude(ll_to_earth(90,-90))::numeric(20,10);   longitude    ---------------- -90.0000000000(1 row)SELECT longitude(ll_to_earth(-45,-90))::numeric(20,10);   longitude    ---------------- -90.0000000000(1 row)SELECT longitude(ll_to_earth(-90,-90))::numeric(20,10);   longitude    ---------------- -90.0000000000(1 row)--

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -