PostGIS之路——幾何物件編輯(二)
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));
返回幾何物件頂點順序相反的幾何物件。
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));
相關文章
- 二維幾何基礎
- 計算幾何 —— 二維幾何基礎 —— 距離度量方法
- three.js 幾何體(二)JS
- 二維幾何常用運算
- 二維計算幾何模板
- 數學趣題:平面幾何(二)
- 計算機圖形學(四)_幾何變換_1_基本的二維幾何變換(二)_旋轉計算機
- 照片和影像編輯應用程式為何盈利?
- QuestMobile:優信二手車能量幾何?
- 平面幾何
- 計算機圖形學(四)_幾何變換_1_基本的二維幾何變換(一)計算機
- 大資料學習之路——java物件導向(二)大資料Java物件
- ZOJ 3806 Incircle and Circumcircle(幾何+二分)
- 幾種開源富文字編輯器對比
- GeoServer二:釋出服務(postgis資料庫)Server資料庫
- CAD屬性編輯操作——物件屬性教程物件
- 計算幾何
- 計算機圖形學(四)_幾何變換_1_基本的二維幾何變換(三)_縮放計算機
- Linux環境PostGIS原始碼編譯安裝Linux原始碼編譯
- 推薦幾款高效的Python文字編輯器!Python
- 地圖編輯器幾種實現的總結地圖
- 推薦幾款火爆的Python線上編輯器Python
- APICloud開發者進階之路 | 編碼優化(二)APICloud優化
- 計算幾何:模板
- CF18A 幾何
- 美國人的幾何
- 計算幾何模板
- CodeForces 887 E. Little Brother(計算幾何+二分)
- 幾種文字編輯器IDE學習難度曲線IDE
- Python寫業務邏輯的幾個編碼原則Python
- 編輯
- UltraEdit--二進位制檔案編輯功能
- AI+基因編輯,為何成為比爾·蓋茨口中的救命良方?AI
- 【第一道計算幾何題】 UVA11178 Morley‘s Theorem (二維幾何,旋轉直線求求交點)REM
- 幾何本質初步猜想
- HDU 6055 Regular polygon(幾何)Go
- [筆記] 計算幾何筆記
- 寵物醫療,成色幾何?