1、ST_Line_Interpolate_Point
返回一个点内插入一条线。第一个参数必须是 一个LINESTRING类型几何对象,第二个参数是一个float8类型,在0和1之间代表总长度一部分的,这个点将被定位。
geometryST_Line_Interpolate_Point(geometry a_linestring, float a_fraction);
可参考:http://hi.baidu.com/zhwtteng/item/9a6fcb3f79fe12cb1a96966c
示例SQL:
SELECT ST_AsEWKT(ST_Line_Interpolate_Point(the_line, 0.5))
FROM (SELECT ST_GeomFromEWKT('LINESTRING(1 2 3, 4 5 6, 6 7 8)') as the_line) As foo;
SELECT ST_AsText(ST_Line_Interpolate_Point(foo.the_line, ST_Line_Locate_Point(foo.the_line, ST_GeomFromText('POINT(4 3)'))))
FROM (SELECT ST_GeomFromText('LINESTRING(1 2, 4 5, 6 7)') As the_line) As foo;
2、ST_Line_Locate_Point
返回a_point离a_linestring在上最近的点位置(这个位置表示为一个0到1浮点数)。点具体的位置我们可以使用前面介绍的ST_Line_Interpolate_Point取出。
floatST_Line_Locate_Point(geometry a_linestring, geometry a_point);
示例SQL:
SELECT ST_AsText(house_loc) As as_text_house_loc,startstreet_num +
CAST( (endstreet_num - startstreet_num)*ST_Line_Locate_Point(street_line, house_loc) As integer) As street_num
FROM (SELECT ST_GeomFromText('LINESTRING(1 2, 3 4)') As street_line,ST_MakePoint(x*1.01,y*1.03) As house_loc, 10 As startstreet_num,
20 As endstreet_num FROM generate_series(1,3) x CROSS JOIN generate_series(2,4) As y)
As foo WHERE ST_DWithin(street_line, house_loc, 0.2);
3、ST_Line_Substring
返回一个线对象,作为一个的子字符串输入开始和结束在二维总长度的分数。第二个和第三个参数是 0和1之间的浮点数。
geometryST_Line_Substring(geometry a_linestring, float startfraction, float endfraction);
示例SQL:
SELECT ST_AsText(ST_Line_SubString(ST_GeomFromText('LINESTRING(25 50, 100 125, 150 190)'), 0.333, 0.666));
4、ST_LocateAlong
返回一个根据指定的测量值与元素相匹配的导出几何对象。不支持面元素。
geometryST_LocateAlong(geometry ageom_with_measure, float a_measure, float offset);
示例SQL:
SELECT ST_AsText(the_geom) FROM (SELECT ST_LocateAlong(
ST_GeomFromText('MULTILINESTRINGM((1 2 3, 3 4 2, 9 4 3),
(1 2 3, 5 4 5))'),3) As the_geom) As foo;
5、ST_LocateBetween (2.0.0版本叫 ST_Locate_Between_Measures)
根据量测值获得几何对象.
geometryST_LocateBetween(geometry geomA, float measure_start, float measure_end, float offset);
示例SQL:
SELECT ST_AsText(the_geom)
FROM
(SELECT ST_LocateBetween(
ST_GeomFromText('MULTILINESTRING M ((1 2 3, 3 4 2, 9 4 3),
(1 2 3, 5 4 5))'),1.5, 3) As the_geom) As foo;
6、ST_LocateBetweenElevations
根据量测值返回一个几何对象集合,这个只支持3D, 4D LINESTRINGS and MULTILINESTRINGS。
geometryST_LocateBetweenElevations(geometry geom_mline, float elevation_start, float elevation_end);
示例SQL:
--Geometry collections are difficult animals so dump them
--to make them more digestable
SELECT ST_AsEWKT((ST_Dump(the_geom)).geom)
FROM
(SELECT ST_LocateBetweenElevations(
ST_GeomFromEWKT('LINESTRING(1 2 6, 4 5 -1, 7 8 9)'),6,9)As the_geom) As foo
7、ST_InterpolatePoint
返回几何点闭合提供的点的测量维度值。
floatST_InterpolatePoint(geometry line, geometry point);
示例SQL:
SELECT ST_InterpolatePoint('LINESTRING M (0 0 0, 10 0 20)', 'POINT(5 5)');
8、ST_AddMeasure
返回一个导出几何对象在开始和结束点之间线性内插一些元素。如果几何没有测量尺寸,添加一个。如果几何形状有一个测量维度,它超出写入一个新值。只支持LINESTRINGS 和 MULTILINESTRINGS。
geometryST_AddMeasure(geometry geom_mline, float measure_start, float measure_end);
示例SQL:
SELECT ST_AsText(ST_AddMeasure(
ST_GeomFromEWKT('MULTILINESTRINGM((1 0 4, 2 0 4, 4 0 4),(1 0 4, 2 0 4, 4 0 4))'),10,70)) As ewelev;