通过添加中间点将平面线或多线边缘转换为测地线。Converts planar line or multiline edges to geodesics by adding intermediate points.


geo_line_densify(lineString, tolerance)geo_line_densify(lineString, tolerance)


  • lineString:采用 GeoJSON 格式,数据类型为动态的一条直线或多条直线。lineString : Line or multiline in the GeoJSON format and of a dynamic data type.
  • tolerance:一个可选数值,用于定义原始平面边缘与转换后的测地线边缘链之间的最大距离(以米为单位)。tolerance : An optional numeric that defines maximum distance in meters between the original planar edge and the converted geodesic edge chain. 支持的值范围为 [0.1, 10000]。Supported values are in the range [0.1, 10000]. 如果未指定,则使用默认值 10If unspecified, the default value 10 is used.


采用 GeoJSON 格式dynamic 数据类型的致密线。Densified line in the GeoJSON format and of a dynamic data type. 如果线或公差无效,则查询会生成 null 结果。If either the line or tolerance is invalid, the query will produce a null result.


  • 对按照 WGS-84 坐标参考系统表示的地理空间坐标进行解释。The geospatial coordinates are interpreted as represented by the WGS-84 coordinate reference system.

LineString 定义LineString definition

dynamic({"type":"LineString","coordinates": [ [lng_1,lat_1], [lng_2,lat_2] ,..., [lng_N,lat_N] ]})dynamic({"type": "LineString","coordinates": [ [lng_1,lat_1], [lng_2,lat_2] ,..., [lng_N,lat_N] ]})

dynamic({"type":"MultiLineString","coordinates": [ [ line_1, line_2 ,..., line_N ] ]})dynamic({"type": "MultiLineString","coordinates": [ [ line_1, line_2 ,..., line_N ] ]})

  • LineString 坐标数组必须至少包含两个条目。LineString coordinates array must contain at least two entries.
  • 坐标 [经度,纬度] 必须有效。The coordinates [longitude,latitude] must be valid. 经度必须是 [-180, +180] 范围内的实数,纬度必须是 [-90, +90] 范围内的实数。The longitude must be a real number in the range [-180, +180] and the latitude must be a real number in the range [-90, +90].
  • 边缘长度必须小于 180 度。The edge length must be less than 180 degrees. 将选择两个顶点之间的最短边缘。The shortest edge between the two vertices will be chosen.


  • 致密线的最大点数限制为 10485760。The maximum number of points in the densified line is limited to 10485760.
  • dynamic 格式存储线有大小限制。Storing lines in dynamic format has size limits.


  • GeoJSON 格式将两点之间的边定义为直笛卡尔线。GeoJSON format defines an edge between two points as a straight cartesian line.
  • 是使用测地线还是平面边缘可能取决于数据集,在长边中尤其如此。The decision to use geodesic or planar edges might depend on the dataset and is especially relevant in long edges.


以下示例致密化曼哈顿岛的一条道路。The following example densifies a road in Manhattan island. 该边缘较短,平面边缘与其对应的测地线之间的距离小于公差规定的距离。The edge is short and the distance between the planar edge and its geodesic counterpart is less than the distance specified by tolerance. 因此,结果保持不变。As such, the result remains unchanged.

print densified_line = tostring(geo_line_densify(dynamic({"type":"LineString","coordinates":[[-73.949247, 40.796860],[-73.973017, 40.764323]]})))
{"type":"LineString","coordinates":[[-73.949247, 40.796860], [-73.973017, 40.764323]]}{"type":"LineString","coordinates":[[-73.949247, 40.796860], [-73.973017, 40.764323]]}

以下示例致密化长度约为 130 公里的边缘The following example densifies an edge of ~130km length

print densified_line = tostring(geo_line_densify(dynamic({"type":"LineString","coordinates":[[50, 50], [51, 51]]})))

下面的示例由于坐标输入无效而返回 null 结果。The following example returns a null result because of the invalid coordinate input.

print densified_line = geo_line_densify(dynamic({"type":"LineString","coordinates":[[300,1],[1,1]]}))

下面的示例由于公差输入无效而返回 null 结果。The following example returns a null result because of the invalid tolerance input.

print densified_line = geo_line_densify(dynamic({"type":"LineString","coordinates":[[1,1],[2,2]]}), 0)