Name

ST_GeomFromWKB — Retourne un objet de type geometry à partir de sa représentation binaire Well-Know Binary (WKB) et d'un SRID optionnel.

Synopsis

geometry ST_GeomFromWKB(bytea geom);

geometry ST_GeomFromWKB(bytea geom, integer srid);

Description

ST_GeomFromWKB prend en paramètre une représentation binaire d'une géométrie (WKB ou EWKB) et un SRID optionnel (SRID) et crée une instance de type geometry. Cette fonction assure le rôle de Geometry Factory en SQL. Alias pour ST_WKBToSQL.

Si le SRID n'est pas précisé, la valeur 0 (indéfini) est prise par défaut.

Cette méthode implémente la spécification OGC Simple Features Implementation Specification for SQL 1.1.

s3.2.7.2 - le paramètre optionnel est issu des tests de conformité

Cette méthode implémente la spécification SQL/MM.

SQL-MM 3 : 5.1.41

Cette méthode prend en charge les types Circular String et Curve.

Exemples

--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)

Voir aussi

ST_WKBToSQL, ST_AsBinary, ST_GeomFromEWKB