1、ST_Reverse
返回几何对象顶点顺序相反的几何对象。
geometry ST_Reverse(geometry g1);
示例SQL:
SELECT ST_AsText(the_geom) as line, ST_AsText(ST_Reverse(the_geom)) As reverseline
FROM
(SELECT ST_MakeLine(ST_MakePoint(1,2),
ST_MakePoint(1,10)) As the_geom) as foo;
2、ST_Rotate、ST_RotateX、ST_RotateY、ST_RotateZ
几何对象旋转(原点、X轴、Y轴、Z轴)。
geometry ST_Rotate(geometry geomA, float rotRadians);
geometry ST_Rotate(geometry geomA, float rotRadians, float x0, float y0);
geometry ST_Rotate(geometry geomA, float rotRadians, geometry pointOrigin);
geometry ST_RotateX(geometry geomA, float rotRadians);
geometry ST_RotateY(geometry geomA, float rotRadians);
geometry ST_RotateZ(geometry geomA, float rotRadians);
示例SQL:
SELECT ST_AsEWKT(ST_Rotate('LINESTRING (50 160, 50 50, 100 50)', pi()));
SELECT ST_AsEWKT(ST_RotateX(ST_GeomFromEWKT('LINESTRING(1 2 3, 1 1 1)'), pi()/2));
3、ST_Scale
按照一定比例调整几何对象坐标,即每个X、Y、Z乘以相应的大小。
geometry ST_Scale(geometry geomA, float XFactor, float YFactor, float ZFactor);
geometry ST_Scale(geometry geomA, float XFactor, float YFactor);
示例SQL:
SELECT ST_AsEWKT(ST_Scale(ST_GeomFromEWKT('LINESTRING(1 2 3, 1 1 1)'), 0.5, 0.75, 0.8));
4、ST_Segmentize
返回一个修改后的几何对象,没有分段长度超过的给定的距离。距离只在二维计算,
geometry ST_Segmentize(geometry geomA, float max_length);
示例SQL:
SELECT ST_AsText(ST_Segmentize(ST_GeomFromText('POLYGON((-29 28, -30 40, -29 28))'),10));
5、ST_SetPoint
将线段上给定位置的点替换为设置的点。(替换线上的点)
geometry ST_SetPoint(geometry linestring, integer zerobasedposition, geometry point);
示例SQL:
SELECT ST_AsText(ST_SetPoint('LINESTRING(-1 2,-1 3)', 0, 'POINT(-1 1)'));
6、ST_SetSRID
给几何对象设置SRID。
geometry ST_SetSRID(geometry geom, integer srid);
示例SQL:
SELECT ST_Transform(ST_SetSRID(ST_Point(-123.365556, 48.428611),4326),3785) As spere_merc;
7、ST_SnapToGrid
将几何对象顶点捕捉到网格。
geometry ST_SnapToGrid(geometry geomA, float originX, float originY, float sizeX, float sizeY);
geometry ST_SnapToGrid(geometry geomA, float sizeX, float sizeY);
geometry ST_SnapToGrid(geometry geomA, float size);
geometry ST_SnapToGrid(geometry geomA, geometry pointOrigin, float sizeX, float sizeY, float sizeZ, float sizeM);
示例SQL:
SELECT ST_AsEWKT(ST_SnapToGrid(
ST_GeomFromEWKT('LINESTRING(-1.1115678 2.123 2.3456 1.11111,
4.111111 3.2374897 3.1234 1.1111, -1.11111112 2.123 2.3456 1.1111112)'),
ST_GeomFromEWKT('POINT(1.12 2.22 3.2 4.4444)'),
0.1, 0.1, 0.1, 0.01) );
8、ST_Snap
根据输入和参考几何对象捕捉几何对象。
geometry ST_Snap(geometry input, geometry reference, float tolerance);
示例SQL:
8、ST_Transform
将几何对象转化到指定空间参考。
geometry ST_Transform(geometry g1, integer srid);
示例SQL:
SELECT ST_AsText(ST_Transform(ST_GeomFromText('POLYGON((743238 2967416,743238 2967450,
743265 2967450,743265.625 2967416,743238 2967416))',2249),4326)) As wgs_geom;
9、ST_Translate
对几何对象作偏移。
geometry ST_Translate(geometry g1, float deltax, float deltay);
geometry ST_Translate(geometry g1, float deltax, float deltay, float deltaz);
示例SQL:
SELECT ST_AsText(ST_Translate(ST_GeomFromText('POINT(-71.01 42.37)',4326),1,0)) As
wgs_transgeomtxt;
10、ST_TransScale
对2D几何对象作偏移和缩放。
geometry ST_TransScale(geometry geomA, float deltaX, float deltaY, float XFactor, float YFactor);
示例SQL:
SELECT ST_AsEWKT(ST_TransScale(ST_GeomFromEWKT('LINESTRING(1 2 3, 1 1 1)'), 0.5, 1, 1, 2));