File: reference_trajectory.xml

package info (click to toggle)
postgis 3.1.1%2Bdfsg-1%2Bdeb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 83,792 kB
  • sloc: ansic: 151,982; sql: 146,734; xml: 51,051; sh: 6,186; cpp: 6,110; perl: 4,852; makefile: 3,002; python: 1,205; yacc: 447; lex: 133; javascript: 6
file content (301 lines) | stat: -rw-r--r-- 8,502 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?xml version="1.0" encoding="UTF-8"?>
<sect1 id="Temporal">
    <sect1info>
    <abstract>
			<para>These functions support working with trajectories.
			A trajectory is a linear geometry with a measure (M value) on each coordinate.
			The measure values must increase along the line.
			Spatio-temporal data can be modelled by using relative times (such as the epoch)
			as the measure values.
			</para>
    </abstract>
    </sect1info>
 	  <title>Trajectory Functions</title>

		<refentry id="ST_IsValidTrajectory">

		  <refnamediv>
			<refname>ST_IsValidTrajectory</refname>
			<refpurpose>
Returns <varname>true</varname> if the geometry is a valid trajectory.
      </refpurpose>
		  </refnamediv>

		  <refsynopsisdiv>
			<funcsynopsis>
			  <funcprototype>
				<funcdef>boolean <function>ST_IsValidTrajectory</function></funcdef>
				<paramdef><type>geometry </type> <parameter>line</parameter></paramdef>
			  </funcprototype>
			</funcsynopsis>
		  </refsynopsisdiv>

		  <refsection>
			<title>Description</title>
			<para>
Tests if a geometry encodes a valid trajectory.
A valid trajectory is represented as a <varname>LINESTRING</varname>
with measures (M values).
The measure values must increase from each vertex to the next.
			</para>
			<para>
Valid trajectories are expected as input to spatio-temporal functions
like <xref linkend="ST_ClosestPointOfApproach" />
			</para>
			<para>Availability: 2.2.0</para>
			<para>&Z_support;</para>
		  </refsection>


		  <refsection>
			<title>Examples</title>
<programlisting>
-- A valid trajectory
SELECT ST_IsValidTrajectory(ST_MakeLine(
  ST_MakePointM(0,0,1),
  ST_MakePointM(0,1,2))
);
 t

-- An invalid trajectory
SELECT ST_IsValidTrajectory(ST_MakeLine(ST_MakePointM(0,0,1), ST_MakePointM(0,1,0)));
NOTICE:  Measure of vertex 1 (0) not bigger than measure of vertex 0 (1)
 st_isvalidtrajectory
----------------------
 f
</programlisting>
		  </refsection>

		  <refsection>
			<title>See Also</title>
			<para>
<xref linkend="ST_ClosestPointOfApproach" />
			</para>
		  </refsection>
		</refentry>

		<refentry id="ST_ClosestPointOfApproach">

		  <refnamediv>
			<refname>ST_ClosestPointOfApproach</refname>
			<refpurpose>
Returns the measure at which points interpolated along two trajectories are closest.
      </refpurpose>
		  </refnamediv>

		  <refsynopsisdiv>
			<funcsynopsis>
			  <funcprototype>
				<funcdef>float8 <function>ST_ClosestPointOfApproach</function></funcdef>
				<paramdef><type>geometry </type> <parameter>track1</parameter></paramdef>
				<paramdef><type>geometry </type> <parameter>track2</parameter></paramdef>
			  </funcprototype>
			</funcsynopsis>
		  </refsynopsisdiv>

		  <refsection>
			<title>Description</title>

			<para>
Returns the smallest measure at which points interpolated along the given
trajectories are at the smallest distance.
      </para>
			<para>
Inputs must be valid trajectories as
checked by <xref linkend="ST_IsValidTrajectory" />. Null is returned if
the trajectories do not overlap in their M ranges.
			</para>

			<para>
See <xref linkend="ST_LocateAlong" /> for getting the actual points at
the given measure.
			</para>

			<para>Availability: 2.2.0</para>
			<para>&Z_support;</para>
		  </refsection>

		  <refsection>
			<title>Examples</title>
<programlisting>
-- Return the time in which two objects moving between 10:00 and 11:00
-- are closest to each other and their distance at that point
WITH inp AS ( SELECT
  ST_AddMeasure('LINESTRING Z (0 0 0, 10 0 5)'::geometry,
    extract(epoch from '2015-05-26 10:00'::timestamptz),
    extract(epoch from '2015-05-26 11:00'::timestamptz)
  ) a,
  ST_AddMeasure('LINESTRING Z (0 2 10, 12 1 2)'::geometry,
    extract(epoch from '2015-05-26 10:00'::timestamptz),
    extract(epoch from '2015-05-26 11:00'::timestamptz)
  ) b
), cpa AS (
  SELECT ST_ClosestPointOfApproach(a,b) m FROM inp
), points AS (
  SELECT ST_Force3DZ(ST_GeometryN(ST_LocateAlong(a,m),1)) pa,
         ST_Force3DZ(ST_GeometryN(ST_LocateAlong(b,m),1)) pb
  FROM inp, cpa
)
SELECT to_timestamp(m) t,
       ST_Distance(pa,pb) distance
FROM points, cpa;

               t               |     distance
-------------------------------+------------------
 2015-05-26 10:45:31.034483+02 | 1.96036833151395
</programlisting>
		  </refsection>

		  <refsection>
			<title>See Also</title>
			<para>
<xref linkend="ST_IsValidTrajectory" />,
<xref linkend="ST_DistanceCPA" />,
<xref linkend="ST_LocateAlong" />,
<xref linkend="ST_AddMeasure" />
			</para>
		  </refsection>
		</refentry>

		<refentry id="ST_DistanceCPA">

		  <refnamediv>
			<refname>ST_DistanceCPA</refname>
			<refpurpose>
Returns the distance between the closest point of approach of two trajectories.
      </refpurpose>
		  </refnamediv>

		  <refsynopsisdiv>
			<funcsynopsis>
			  <funcprototype>
				<funcdef>float8 <function>ST_DistanceCPA</function></funcdef>
				<paramdef><type>geometry </type> <parameter>track1</parameter></paramdef>
				<paramdef><type>geometry </type> <parameter>track2</parameter></paramdef>
			  </funcprototype>
			</funcsynopsis>
		  </refsynopsisdiv>

		  <refsection>
			<title>Description</title>

			<para>
Returns the minimum distance two moving objects have ever been each other.
      </para>
			<para>
Inputs must be valid trajectories as checked by
<xref linkend="ST_IsValidTrajectory" />.
Null is returned if the trajectories do not overlap in their M ranges.
			</para>

			<para>Availability: 2.2.0</para>
			<para>&Z_support;</para>
		  </refsection>


		  <refsection>
			<title>Examples</title>
<programlisting>
-- Return the minimum distance of two objects moving between 10:00 and 11:00
WITH inp AS ( SELECT
  ST_AddMeasure('LINESTRING Z (0 0 0, 10 0 5)'::geometry,
    extract(epoch from '2015-05-26 10:00'::timestamptz),
    extract(epoch from '2015-05-26 11:00'::timestamptz)
  ) a,
  ST_AddMeasure('LINESTRING Z (0 2 10, 12 1 2)'::geometry,
    extract(epoch from '2015-05-26 10:00'::timestamptz),
    extract(epoch from '2015-05-26 11:00'::timestamptz)
  ) b
)
SELECT ST_DistanceCPA(a,b) distance FROM inp;

     distance
------------------
 1.96036833151395
</programlisting>
		  </refsection>

		  <refsection>
			<title>See Also</title>
			<para>
<xref linkend="ST_IsValidTrajectory" />,
<xref linkend="ST_ClosestPointOfApproach" />,
<xref linkend="ST_AddMeasure" />,
<xref linkend="geometry_distance_cpa" />
			</para>
		  </refsection>
		</refentry>

		<refentry id="ST_CPAWithin">

		  <refnamediv>
			<refname>ST_CPAWithin</refname>
			<refpurpose>
Returns <varname>true</varname> if the closest point of approach of two trajectories
is within the specified distance.
      </refpurpose>
		  </refnamediv>

		  <refsynopsisdiv>
			<funcsynopsis>
			  <funcprototype>
				<funcdef>boolean <function>ST_CPAWithin</function></funcdef>
				<paramdef><type>geometry </type> <parameter>track1</parameter></paramdef>
				<paramdef><type>geometry </type> <parameter>track2</parameter></paramdef>
				<paramdef><type>float8 </type> <parameter>maxdist</parameter></paramdef>
			  </funcprototype>
			</funcsynopsis>
		  </refsynopsisdiv>

		  <refsection>
			<title>Description</title>

			<para>
Checks whether two moving objects have ever been within the
specified maximum distance.
      </para>
			<para>
Inputs must be valid trajectories as checked by
<xref linkend="ST_IsValidTrajectory" />.
False is returned if the trajectories do not overlap in their M ranges.
			</para>

			<para>Availability: 2.2.0</para>
			<para>&Z_support;</para>
		  </refsection>


		  <refsection>
			<title>Examples</title>
<programlisting>
WITH inp AS ( SELECT
  ST_AddMeasure('LINESTRING Z (0 0 0, 10 0 5)'::geometry,
    extract(epoch from '2015-05-26 10:00'::timestamptz),
    extract(epoch from '2015-05-26 11:00'::timestamptz)
  ) a,
  ST_AddMeasure('LINESTRING Z (0 2 10, 12 1 2)'::geometry,
    extract(epoch from '2015-05-26 10:00'::timestamptz),
    extract(epoch from '2015-05-26 11:00'::timestamptz)
  ) b
)
SELECT ST_CPAWithin(a,b,2), ST_DistanceCPA(a,b) distance FROM inp;

 st_cpawithin |     distance
--------------+------------------
 t            | 1.96521473776207
</programlisting>
		  </refsection>

		  <!-- Optionally add a "See Also" section -->
		  <refsection>
			<title>See Also</title>
			<para>
<xref linkend="ST_IsValidTrajectory" />,
<xref linkend="ST_ClosestPointOfApproach" />,
<xref linkend="ST_DistanceCPA" />,
<xref linkend="geometry_distance_cpa" />
			</para>
		  </refsection>
		</refentry>

  </sect1>