Name

ST_GeomFromWKB — Crea una instancia de geometría desde la representación de una geometría en "Well-Known Binary" (WKB) y un SRID opcional.

Synopsis

geometry ST_GeomFromWKB(bytea geom);

geometry ST_GeomFromWKB(bytea geom, integer srid);

Descripción

La función ST_GeomFromWKB, toma una representación binaria "well-known" de una geometría y un ID de un Sistema de Referencia Espacial (SRID) y crea una instancia del tipo de geometría adecuado. Esta función juega un rol de "Geometry Factory" en SQL. Es un nombre alternativo para ST_WKBToSQL.

Si no se especifica SRID, el valor predeterminado es 0 (desconocido).

This method implements the OGC Simple Features Implementation Specification for SQL 1.1. s3.2.7.2 - El SRID opcional es para el paquete de conformidad

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

This method supports Circular Strings and Curves.

Ejemplos

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)
);
SRID=4326;LINESTRING(-113.98 39.198,-113.981 39.195)
SELECT
  ST_AsText(ST_GeomFromWKB(ST_AsEWKB('POINT(2 5)'::geometry)
        )
  );
POINT(2 5)