Skip to content

Commit fc28541

Browse files
authored
Merge pull request #645 from Maxxen/main-dev
Add `st_interpolatepoint`, `st_locatealong`, `st_locatebetween`, `st_linelocatepoint`
2 parents 038164a + 3a0b999 commit fc28541

File tree

10 files changed

+1370
-227
lines changed

10 files changed

+1370
-227
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ AlwaysBreakTemplateDeclarations: Yes
2727
IncludeBlocks: Regroup
2828
Language: Cpp
2929
AccessModifierOffset: -4
30+
CommentPragmas: '^[^ ]'
3031
---
3132
Language: Java
3233
SpaceAfterCStyleCast: true

docs/functions.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
| [`ST_HasM`](#st_hasm) | Check if the input geometry has M values. |
6464
| [`ST_HasZ`](#st_hasz) | Check if the input geometry has Z values. |
6565
| [`ST_Hilbert`](#st_hilbert) | Encodes the X and Y values as the hilbert curve index for a curve covering the given bounding box. |
66+
| [`ST_InterpolatePoint`](#st_interpolatepoint) | Computes the closest point on a LINESTRING to a given POINT and returns the interpolated M value of that point. |
6667
| [`ST_Intersection`](#st_intersection) | Returns the intersection of two geometries |
6768
| [`ST_Intersects`](#st_intersects) | Returns true if the geometries intersect |
6869
| [`ST_Intersects_Extent`](#st_intersects_extent) | Returns true if the extent of two geometries intersects |
@@ -75,9 +76,12 @@
7576
| [`ST_Length_Spheroid`](#st_length_spheroid) | Returns the length of the input geometry in meters, using an ellipsoidal model of the earth |
7677
| [`ST_LineInterpolatePoint`](#st_lineinterpolatepoint) | Returns a point interpolated along a line at a fraction of total 2D length. |
7778
| [`ST_LineInterpolatePoints`](#st_lineinterpolatepoints) | Returns a multi-point interpolated along a line at a fraction of total 2D length. |
79+
| [`ST_LineLocatePoint`](#st_linelocatepoint) | Returns the location on a line closest to a point as a fraction of the total 2D length of the line. |
7880
| [`ST_LineMerge`](#st_linemerge) | "Merges" the input line geometry, optionally taking direction into account. |
7981
| [`ST_LineString2DFromWKB`](#st_linestring2dfromwkb) | Deserialize a LINESTRING_2D from a WKB encoded blob |
8082
| [`ST_LineSubstring`](#st_linesubstring) | Returns a substring of a line between two fractions of total 2D length. |
83+
| [`ST_LocateAlong`](#st_locatealong) | Returns a point or multi-point, containing the point(s) at the geometry with the given measure |
84+
| [`ST_LocateBetween`](#st_locatebetween) | Returns a geometry or geometry collection created by filtering and interpolating vertices within a range of "M" values |
8185
| [`ST_M`](#st_m) | Returns the M coordinate of a point geometry |
8286
| [`ST_MMax`](#st_mmax) | Returns the maximum M coordinate of a geometry |
8387
| [`ST_MMin`](#st_mmin) | Returns the minimum M coordinate of a geometry |
@@ -1491,6 +1495,24 @@ For the BOX_2D and BOX_2DF variants, the center of the box is used as the point
14911495

14921496
----
14931497

1498+
### ST_InterpolatePoint
1499+
1500+
1501+
#### Signature
1502+
1503+
```sql
1504+
DOUBLE ST_InterpolatePoint (line GEOMETRY, point GEOMETRY)
1505+
```
1506+
1507+
#### Description
1508+
1509+
Computes the closest point on a LINESTRING to a given POINT and returns the interpolated M value of that point.
1510+
1511+
First argument must be a linestring and must have a M dimension. The second argument must be a point.
1512+
Neither argument can be empty.
1513+
1514+
----
1515+
14941516
### ST_Intersection
14951517

14961518

@@ -1683,6 +1705,21 @@ otherwise, the result is a multi-point with points repeated at the fraction inte
16831705

16841706
----
16851707

1708+
### ST_LineLocatePoint
1709+
1710+
1711+
#### Signature
1712+
1713+
```sql
1714+
DOUBLE ST_LineLocatePoint (line GEOMETRY, point GEOMETRY)
1715+
```
1716+
1717+
#### Description
1718+
1719+
Returns the location on a line closest to a point as a fraction of the total 2D length of the line.
1720+
1721+
----
1722+
16861723
### ST_LineMerge
16871724

16881725

@@ -1729,6 +1766,52 @@ Returns a substring of a line between two fractions of total 2D length.
17291766

17301767
----
17311768

1769+
### ST_LocateAlong
1770+
1771+
1772+
#### Signatures
1773+
1774+
```sql
1775+
GEOMETRY ST_LocateAlong (line GEOMETRY, measure DOUBLE, offset DOUBLE)
1776+
GEOMETRY ST_LocateAlong (line GEOMETRY, measure DOUBLE)
1777+
```
1778+
1779+
#### Description
1780+
1781+
Returns a point or multi-point, containing the point(s) at the geometry with the given measure
1782+
1783+
For a LINESTRING, or MULTILINESTRING, the location is determined by interpolating between M values
1784+
For a POINT and MULTIPOINT, the point is returned if the measure matches the M value of the vertex, otherwise an empty geometry is returned
1785+
For a POLYGON, only the exterior ring is considered, and treated as a LINESTRING
1786+
1787+
If offset is provided, the resulting point(s) is offset by the given amount perpendicular to the line direction.
1788+
1789+
----
1790+
1791+
### ST_LocateBetween
1792+
1793+
1794+
#### Signatures
1795+
1796+
```sql
1797+
GEOMETRY ST_LocateBetween (line GEOMETRY, start_measure DOUBLE, end_measure DOUBLE, offset DOUBLE)
1798+
GEOMETRY ST_LocateBetween (line GEOMETRY, start_measure DOUBLE, end_measure DOUBLE)
1799+
```
1800+
1801+
#### Description
1802+
1803+
Returns a geometry or geometry collection created by filtering and interpolating vertices within a range of "M" values
1804+
1805+
Creates a geometry or geometry collection, containing the parts formed by vertices that have an "M" value within the "start_measure" and "end_measure" range
1806+
1807+
For LINESTRING or MULTILINESTRING, if a line segment would cross either the upper or lower bound, a vertex is added by interpolating the coordinates at the "intersection"
1808+
For a POINT and MULTIPOINT, the point is added to the collection if its vertex has an "M" value within the range, otherwise it is skipped
1809+
For a POLYGON, only the exterior ring is considered, and treated like a LINESTRING
1810+
1811+
If offset is provided, the resulting vertices are offset by the given amount perpendicular to the line direction.
1812+
1813+
----
1814+
17321815
### ST_M
17331816

17341817

0 commit comments

Comments
 (0)