forked from postgis/postgis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds lwgeom_is_trajectory and lwline_is_trajectory to liblwgeom. Includes unit and regress test. Includes documentation, starting a new "Temporal support" section in which ST_ClosestPointOfApproach is also moved git-svn-id: http://svn.osgeo.org/postgis/trunk@13570 b70326c6-7e19-0410-871a-916f4a2858ee
- Loading branch information
Sandro Santilli
committed
May 28, 2015
1 parent
3947f98
commit 03c15d5
Showing
15 changed files
with
292 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<sect1 id="Temporal"> | ||
<title>Temporal Support</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> | ||
Tell if a geometry encodes a valid trajectory. | ||
Valid trajectories are encoded as LINESTRING with M value growing | ||
from each vertex to the next. | ||
</para> | ||
|
||
<para> | ||
Valid trajectories are expected as input to some spatio-temporal queries | ||
like <xref linkend="ST_ClosestPointOfApproach" /> | ||
</para> | ||
|
||
<para>Availability: 2.2.0</para> | ||
<para>&Z_support;</para> | ||
</refsection> | ||
|
||
|
||
<refsection> | ||
<title>Examples</title> | ||
<programlisting> | ||
SELECT ST_IsValidTrajectory(ST_MakeLine( | ||
ST_MakePointM(0,0,1), | ||
ST_MakePointM(0,1,2)) | ||
); | ||
st_isvalidtrajectory | ||
---------------------- | ||
t | ||
</programlisting> | ||
</refsection> | ||
|
||
<!-- Optionally add a "See Also" section --> | ||
<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 lines 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 point interpolated along the given | ||
lines are at the smallest distance. Inputs must be valid trajectories as | ||
checked by <xref linkend="ST_IsValidTrajectory" />. | ||
</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> | ||
|
||
<!-- Optionally add a "See Also" section --> | ||
<refsection> | ||
<title>See Also</title> | ||
<para> | ||
<xref linkend="ST_IsValidTrajectory" />, | ||
<xref linkend="ST_LocateAlong" />, | ||
<xref linkend="ST_AddMeasure" /> | ||
</para> | ||
</refsection> | ||
</refentry> | ||
|
||
</sect1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.