Name

ST_GeomFromWKB — 从知名的二进制几何图形表示(WKB)和可选SRID创建几何图形实例。

Synopsis

geometry ST_GeomFromWKB(bytea geom);

geometry ST_GeomFromWKB(bytea geom, integer srid);

描述

这个 ST_GeomFromWKB 函数接受几何图形的众所周知的二进制表示形式和空间参考系ID( SRID ),并创建相应几何图形类型的实例。此函数在SQL中扮演几何图形工厂的角色。这是ST_WKBToSQL的备用名称。

如果未指定SRID,则默认为0(未知)。

This method implements the OGC Simple Features Implementation Specification for SQL 1.1. S3.2.7.2-可选的SRID来自一致性套件

This method implements the SQL/MM specification. SQL-MM 3:5.1.41

This method supports Circular Strings and Curves

示例

--Although bytea rep contains single \, these need to be escaped when inserting into a table
                -- unless standard_conforming_strings is set to on.
SELECT ST_AsEWKT(
ST_GeomFromWKB(E'\\001\\002\\000\\000\\000\\002\\000\\000\\000\\037\\205\\353Q\\270~\\\\\\300\\323Mb\\020X\\231C@\\020X9\\264\\310~\\\\\\300)\\\\\\217\\302\\365\\230C@',4326)
);
                                          st_asewkt
------------------------------------------------------
 SRID=4326;LINESTRING(-113.98 39.198,-113.981 39.195)
(1 row)

SELECT
  ST_AsText(
        ST_GeomFromWKB(
          ST_AsEWKB('POINT(2 5)'::geometry)
        )
  );
 st_astext
------------
 POINT(2 5)
(1 row)

另请参阅

ST_WKBToSQL, ST_AsBinary, ST_GeomFromEWKB