Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65bf5a3

Browse files
committed
Add missing earthdistance regression test files.
1 parenta6c00af commit65bf5a3

File tree

2 files changed

+458
-0
lines changed

2 files changed

+458
-0
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
--
2+
-- Test earth distance functions
3+
--
4+
--
5+
-- first, define the datatype. Turn off echoing so that expected file
6+
-- does not depend on contents of earthdistance.sql or cube.sql.
7+
--
8+
\set ECHO none
9+
--
10+
-- Test getting the distance between two points using geo_distance.
11+
--
12+
select geo_distance('(0,0)'::point,'(0,0)'::point)::numeric(20,5);
13+
geo_distance
14+
--------------
15+
0.00000
16+
(1 row)
17+
18+
select geo_distance('(0,0)'::point,'(180,0)'::point)::numeric(20,5);
19+
geo_distance
20+
--------------
21+
12436.77274
22+
(1 row)
23+
24+
select geo_distance('(0,0)'::point,'(0,90)'::point)::numeric(20,5);
25+
geo_distance
26+
--------------
27+
6218.38637
28+
(1 row)
29+
30+
select geo_distance('(0,0)'::point,'(90,0)'::point)::numeric(20,5);
31+
geo_distance
32+
--------------
33+
6218.38637
34+
(1 row)
35+
36+
select geo_distance('(0,0)'::point,'(1,0)'::point)::numeric(20,5);
37+
geo_distance
38+
--------------
39+
69.09318
40+
(1 row)
41+
42+
select geo_distance('(0,0)'::point,'(0,1)'::point)::numeric(20,5);
43+
geo_distance
44+
--------------
45+
69.09318
46+
(1 row)
47+
48+
select geo_distance('(0,30)'::point,'(1,30)'::point)::numeric(20,5);
49+
geo_distance
50+
--------------
51+
59.83626
52+
(1 row)
53+
54+
select geo_distance('(0,30)'::point,'(0,31)'::point)::numeric(20,5);
55+
geo_distance
56+
--------------
57+
69.09318
58+
(1 row)
59+
60+
select geo_distance('(0,60)'::point,'(1,60)'::point)::numeric(20,5);
61+
geo_distance
62+
--------------
63+
34.54626
64+
(1 row)
65+
66+
select geo_distance('(0,60)'::point,'(0,61)'::point)::numeric(20,5);
67+
geo_distance
68+
--------------
69+
69.09318
70+
(1 row)
71+
72+
select geo_distance('(87.6,41.8)'::point,'(106.7,35.1)'::point)::numeric(20,5);
73+
geo_distance
74+
--------------
75+
1129.18983
76+
(1 row)
77+
78+
select (geo_distance('(87.6,41.8)'::point,'(106.7,35.1)'::point)*5280.*12.*2.54/100.)::numeric(20,5);
79+
numeric
80+
---------------
81+
1817254.87730
82+
(1 row)
83+
84+
--
85+
-- Test getting the distance between two points using the <@> operator.
86+
--
87+
select ('(0,0)'::point <@> '(0,0)'::point)::numeric(20,5);
88+
numeric
89+
---------
90+
0.00000
91+
(1 row)
92+
93+
select ('(0,0)'::point <@> '(180,0)'::point)::numeric(20,5);
94+
numeric
95+
-------------
96+
12436.77274
97+
(1 row)
98+
99+
select ('(0,0)'::point <@> '(0,90)'::point)::numeric(20,5);
100+
numeric
101+
------------
102+
6218.38637
103+
(1 row)
104+
105+
select ('(0,0)'::point <@> '(90,0)'::point)::numeric(20,5);
106+
numeric
107+
------------
108+
6218.38637
109+
(1 row)
110+
111+
select ('(0,0)'::point <@> '(1,0)'::point)::numeric(20,5);
112+
numeric
113+
----------
114+
69.09318
115+
(1 row)
116+
117+
select ('(0,0)'::point <@> '(0,1)'::point)::numeric(20,5);
118+
numeric
119+
----------
120+
69.09318
121+
(1 row)
122+
123+
select ('(0,30)'::point <@> '(1,30)'::point)::numeric(20,5);
124+
numeric
125+
----------
126+
59.83626
127+
(1 row)
128+
129+
select ('(0,30)'::point <@> '(0,31)'::point)::numeric(20,5);
130+
numeric
131+
----------
132+
69.09318
133+
(1 row)
134+
135+
select ('(0,60)'::point <@> '(1,60)'::point)::numeric(20,5);
136+
numeric
137+
----------
138+
34.54626
139+
(1 row)
140+
141+
select ('(0,60)'::point <@> '(0,61)'::point)::numeric(20,5);
142+
numeric
143+
----------
144+
69.09318
145+
(1 row)
146+
147+
select ('(87.6,41.8)'::point <@> '(106.7,35.1)'::point)::numeric(20,5);
148+
numeric
149+
------------
150+
1129.18983
151+
(1 row)
152+
153+
select (('(87.6,41.8)'::point <@> '(106.7,35.1)'::point)*5280.*12.*2.54/100.)::numeric(20,5);
154+
numeric
155+
---------------
156+
1817254.87730
157+
(1 row)
158+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp