跳转至

Geometry translate expression(几何平移表达式)

Supported in: Batch, Faster, Streaming

Applies a translation to a geometry. Two dimensional geometries are only converted to three dimensional geometries if a z offset is supplied.

Expression categories: Geospatial

Declared arguments

  • Geometry column: The geometries to be translated.
    Expression\
  • Projected coordinate system: Coordinate system identifier formatted as "authority:id". For example, UTM zone 18N could be identified by EPSG:32618. Geometries will be cast to the source coordinate system, have a translation applied, then re-cast to WGS84.
    Literal\
  • X offset: The distance in the coordinate reference system that the geometry will be translated in the positive x direction.
    Literal\
  • Y offset: The distance in the coordinate reference system that the geometry will be translated in the positive y direction.
    Literal\
  • optional Z offset: The distance in the coordinate reference system that the geometry will be translated in the positive z direction.
    Literal\

Output type: Geometry

Examples

Example 1: Base case

Argument values:

  • Geometry column: geometry
  • Projected coordinate system: EPSG:4326
  • X offset: 1.0
  • Y offset: -1.0
  • Z offset: null
geometry Output
{"type":"Point","coordinates":[0.0, 0.0]} {"type":"Point","coordinates":[1.0, -1.0]}
{"type":"LineString","coordinates":[[0.0, 0.0], [1.0, 1.0]]} {"type":"LineString","coordinates":[[1.0, -1.0], [2.0, 0.0]]}
{"type":"Polygon","coordinates":[[[0.0, 0.0],[1.0, 0.0],[1.0, 1.0],[0.0, 1.0], [0.0, 0.0]]]} {"type":"Polygon","coordinates":[[[1.0, -1.0],[2.0, -1.0],[2.0, 0.0],[1.0, 0.0],[1.0, -1.0]]]}

Example 2: Base case

Argument values:

  • Geometry column: geometry
  • Projected coordinate system: EPSG:4326
  • X offset: 1.0
  • Y offset: -1.0
  • Z offset: 1.0
geometry Output
{"type":"Point","coordinates":[0.0, 0.0]} {"type":"Point","coordinates":[1.0, -1.0, 1.0]}
{"type":"LineString","coordinates":[[0.0, 0.0], [1.0, 1.0]]} {"type":"LineString","coordinates":[[1.0, -1.0, 1.0], [2.0, 0.0, 1.0]]}
{"type":"Polygon","coordinates":[[[0.0, 0.0],[1.0, 0.0],[1.0, 1.0],[0.0, 1.0], [0.0, 0.0]]]} {"type":"Polygon","coordinates":[[[1.0, -1.0, 1.0],[2.0, -1.0, 1.0],[2.0, 0.0, 1.0],[1.0, 0.0, 1.0],[1.0, -1.0, 1.0]]]}

Example 3: Base case

Argument values:

  • Geometry column: geometry
  • Projected coordinate system: EPSG:4326
  • X offset: 1.0
  • Y offset: -1.0
  • Z offset: 1.0
geometry Output
{"type":"Point","coordinates":[0.0, 0.0, -1.0]} {"type":"Point","coordinates":[1.0, -1.0, 0.0]}
{"type":"LineString","coordinates":[[0.0, 0.0, -1.0], [1.0, 1.0, -1.0]]} {"type":"LineString","coordinates":[[1.0, -1.0, 0.0], [2.0, 0.0, 0.0]]}
{"type":"Polygon","coordinates":[[[0.0, 0.0, -1.0],[1.0, 0.0, -1.0],[1.0, 1.0, -1.0],[0.0, 1.0, -1.0],[0.0, 0.0, -1.0]]]} {"type":"Polygon","coordinates":[[[1.0, -1.0, 0.0],[2.0, -1.0, 0.0],[2.0, 0.0, 0.0],[1.0, 0.0, 0.0],[1.0, -1.0, 0.0]]]}

Example 4: Base case

Argument values:

  • Geometry column: geometry
  • Projected coordinate system: EPSG:32618
  • X offset: 100.0
  • Y offset: -200.0
  • Z offset: null
geometry Output
{"type":"Point","coordinates":[-77.0, 20.0]} {"type":"Point","coordinates":[-76.99902180032066, 19.99820455178219]}

Example 5: Null case

Argument values:

  • Geometry column: geometry
  • Projected coordinate system: EPSG:4326
  • X offset: 1.0
  • Y offset: -1.0
  • Z offset: 1.0
geometry Output
null null


中文翻译

几何平移表达式

支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)

对几何图形应用平移变换。仅当提供Z轴偏移量时,二维几何图形才会转换为三维几何图形。

表达式类别: 地理空间(Geospatial)

声明的参数

  • 几何列(Geometry column): 需要平移的几何图形。
    表达式\
  • 投影坐标系(Projected coordinate system): 格式为"authority:id"的坐标系标识符。例如,UTM 18N区可标识为EPSG:32618。几何图形将先转换为源坐标系,应用平移,再重新转换为WGS84坐标系。
    字面量\
  • X轴偏移量(X offset): 几何图形在坐标系中沿X轴正方向平移的距离。
    字面量\
  • Y轴偏移量(Y offset): 几何图形在坐标系中沿Y轴正方向平移的距离。
    字面量\
  • 可选 Z轴偏移量(Z offset): 几何图形在坐标系中沿Z轴正方向平移的距离。
    字面量\

输出类型: 几何图形(Geometry)

示例

示例1:基础情况

参数值:

  • 几何列: geometry
  • 投影坐标系: EPSG:4326
  • X轴偏移量: 1.0
  • Y轴偏移量: -1.0
  • Z轴偏移量: null
geometry 输出
{"type":"Point","coordinates":[0.0, 0.0]} {"type":"Point","coordinates":[1.0, -1.0]}
{"type":"LineString","coordinates":[[0.0, 0.0], [1.0, 1.0]]} {"type":"LineString","coordinates":[[1.0, -1.0], [2.0, 0.0]]}
{"type":"Polygon","coordinates":[[[0.0, 0.0],[1.0, 0.0],[1.0, 1.0],[0.0, 1.0], [0.0, 0.0]]]} {"type":"Polygon","coordinates":[[[1.0, -1.0],[2.0, -1.0],[2.0, 0.0],[1.0, 0.0],[1.0, -1.0]]]}

示例2:基础情况

参数值:

  • 几何列: geometry
  • 投影坐标系: EPSG:4326
  • X轴偏移量: 1.0
  • Y轴偏移量: -1.0
  • Z轴偏移量: 1.0
geometry 输出
{"type":"Point","coordinates":[0.0, 0.0]} {"type":"Point","coordinates":[1.0, -1.0, 1.0]}
{"type":"LineString","coordinates":[[0.0, 0.0], [1.0, 1.0]]} {"type":"LineString","coordinates":[[1.0, -1.0, 1.0], [2.0, 0.0, 1.0]]}
{"type":"Polygon","coordinates":[[[0.0, 0.0],[1.0, 0.0],[1.0, 1.0],[0.0, 1.0], [0.0, 0.0]]]} {"type":"Polygon","coordinates":[[[1.0, -1.0, 1.0],[2.0, -1.0, 1.0],[2.0, 0.0, 1.0],[1.0, 0.0, 1.0],[1.0, -1.0, 1.0]]]}

示例3:基础情况

参数值:

  • 几何列: geometry
  • 投影坐标系: EPSG:4326
  • X轴偏移量: 1.0
  • Y轴偏移量: -1.0
  • Z轴偏移量: 1.0
geometry 输出
{"type":"Point","coordinates":[0.0, 0.0, -1.0]} {"type":"Point","coordinates":[1.0, -1.0, 0.0]}
{"type":"LineString","coordinates":[[0.0, 0.0, -1.0], [1.0, 1.0, -1.0]]} {"type":"LineString","coordinates":[[1.0, -1.0, 0.0], [2.0, 0.0, 0.0]]}
{"type":"Polygon","coordinates":[[[0.0, 0.0, -1.0],[1.0, 0.0, -1.0],[1.0, 1.0, -1.0],[0.0, 1.0, -1.0],[0.0, 0.0, -1.0]]]} {"type":"Polygon","coordinates":[[[1.0, -1.0, 0.0],[2.0, -1.0, 0.0],[2.0, 0.0, 0.0],[1.0, 0.0, 0.0],[1.0, -1.0, 0.0]]]}

示例4:基础情况

参数值:

  • 几何列: geometry
  • 投影坐标系: EPSG:32618
  • X轴偏移量: 100.0
  • Y轴偏移量: -200.0
  • Z轴偏移量: null
geometry 输出
{"type":"Point","coordinates":[-77.0, 20.0]} {"type":"Point","coordinates":[-76.99902180032066, 19.99820455178219]}

示例5:空值情况

参数值:

  • 几何列: geometry
  • 投影坐标系: EPSG:4326
  • X轴偏移量: 1.0
  • Y轴偏移量: -1.0
  • Z轴偏移量: 1.0
geometry 输出
null null