ST_AsBinary
更新時(shí)間:
返回給定Geometry對(duì)象或Geography對(duì)象的WKB表示,其中不包含SRID元數(shù)據(jù)信息。
語(yǔ)法
bytea ST_AsBinary(geometry g1);
bytea ST_AsBinary(geometry g1, text NDRorXDR);
bytea ST_AsBinary(geography g1);
bytea ST_AsBinary(geography g1, text NDRorXDR);
參數(shù)
參數(shù)名稱 | 描述 |
g1 | 目標(biāo)Geometry或Geography對(duì)象。 |
NDRorXDR | Little endian或Big endian,機(jī)器字節(jié)序。使用大端在前還是小端在前,默認(rèn)使用小端在前。
|
描述
標(biāo)準(zhǔn)WKB規(guī)范不包括SRID。要獲取具有SRID信息的WKB對(duì)象,請(qǐng)使用ST_AsEWKB函數(shù)。
該函數(shù)支持Circular Strings、Curves、Polyhedral surfaces、Triangles、Triangulated Irregular Network Surfaces(TIN)和3D對(duì)象。
示例
默認(rèn)使用小端在前,示例如下:
SELECT ST_AsBinary(ST_GeomFromText('POLYGON((1 1,1 2,2 2,2 1,1 1))',4326)); st_asbinary --------------------------------------------------------------- \x01030000000100000005000000000000000000f03f000000000000f03f0. .00000000000f03f0000000000000040000000000000004000000000000000. .400000000000000040000000000000f03f000000000000f03f00000000000. .0f03f (1 row)
指定大端在前,示例如下:
SELECT ST_AsBinary(ST_GeomFromText('POLYGON((1 1,1 2,2 2,2 1,1 1))',4326),'XDR'); st_asbinary --------------------------------------------------------------- \x000000000300000001000000053ff00000000000003ff00000000000003. .ff00000000000004000000000000000400000000000000040000000000000. .0040000000000000003ff00000000000003ff00000000000003ff00000000. .00000 (1 row)
文檔內(nèi)容是否對(duì)您有幫助?