Top 5 Recent Articles
ARTICLES CATEGORIES
- Algorithms (22)
- All (399)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Conversion (2)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (13)
- GPS (1)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- LiDAR (1)
- Linear Referencing (4)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (5)
- Open Source (18)
- Oracle Spatial and Locator (194)
- Partitioning (1)
- PostGIS (36)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (37)
- Space Curves (9)
- Spatial Database Functions (109)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (17)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (2)
STLineInterpolatePoint
STLineInterpolatePoint — Returns point geometry at supplied fraction along linestring.
Function Specification
Function [$(lrsowner)].[STLineInterpolatePoint] ( @p_linestring geometry, @p_fraction Float @p_round_xy int = 3, @p_round_zm int = 2 ) Returns geometry
Description
Given a fraction between 0 and 1.0, this function returns a geometry point at the position described by that ratio.
Ratio is combined with length, so @p_ratio of 1.0 is equivalent to @p_linestring.STLength() ie @p_linestring.STEndPoint().
For example, @p_ratio value of 0.5 returns point at exact midpoint of linestring (ct centroid).
Supports measured and unmeasured linestrings.
Supports LineStrings with CircularString elements.
Notes
Wrapper over lrs.STFindPointByRatio
Implements PostGIS ST_LineInterpolatePoint function.
Parameters
@p_linestring (geometry) - Linestring (including CircularString) geometry. @p_ratio (float) - Length ratio between 0.0 and 1.0. If Null, @p_linestring is returned. @p_round_xy (int) - Decimal degrees of precision to which calculated XY ordinates are rounded. @p_round_zm (int) - Decimal degrees of precision to which calculated ZM ordinates are rounded.
Result
The function calculates and returns point at provided measure/length fraction from start.
Examples
-- Linestring select f.fraction, [$(lrsowner)].[STLineInterpolatePoint] ( @p_linestring geometry::STGeomFromText('LINESTRING(-4 -4 0 1, 0 0 0 5.6, 10 0 0 15.61, 10 10 0 25.4)',0), @p_fraction f.fraction, @p_round_xy 4, @p_round_zm 3 ).AsTextZM() as fPoint from (select 0.01 * CAST(t.IntValue as numeric) as fraction from [dbo].[Generate_Series](1,100,10) as t ) as f order by f.fraction GO fraction fPoint 0.01 POINT (-3.8186 -3.8186 0 1.046) 0.11 POINT (-2.0044 -2.0044 0 1.506) 0.21 POINT (-0.1902 -0.1902 0 1.966) 0.31 POINT (2.2968 0 0 6.496) 0.41 POINT (4.8625 0 0 7.497) 0.51 POINT (7.4281 0 0 8.498) 0.61 POINT (9.9938 0 0 9.499) 0.71 POINT (10 2.5595 0 16.587) 0.81 POINT (10 5.1252 0 17.566) 0.91 POINT (10 7.6909 0 18.545) -- Unmeasured 2D Compound curve test. select f.fraction, [$(lrsowner)].[STLineInterpolatePoint] ( geometry::STGeomFromText('COMPOUNDCURVE(CIRCULARSTRING (3 6.3246, 0 7, -3 6.3246),(-3 6.3246, 0 0, 3 6.3246))',0), f.fraction, 4, 3 ).AsTextZM() as fPoint from (select 0.01 * CAST(t.IntValue as numeric) as fraction from [dbo].[Generate_Series](1,100,10) as t ) as f order by f.fraction GO fraction fPoint 0.01 POINT (2.8163 6.4085) 0.11 POINT (0.876 6.945) 0.21 POINT (-1.1367 6.9071) 0.31 POINT (-2.9736 6.269) 0.41 POINT (-2.1079 4.4439) 0.51 POINT (-1.2421 2.6187) 0.61 POINT (-0.3764 0.7935) 0.71 POINT (0.4893 1.0316) 0.81 POINT (1.3551 2.8568) 0.91 POINT (2.2208 4.682)
Documentation
- MySQL Spatial General Functions
- Oracle LRS Objects
- Oracle Spatial Exporter (Java + pl/SQL)
- Oracle Spatial Object Functions
- Oracle Spatial Object Functions (Multi Page)
- PostGIS pl/pgSQL Functions
- SC4O Oracle Java Topology Suite (Java + pl/SQL)
- SQL Server Spatial General TSQL Functions
- SQL Server Spatial LRS TSQL Functions