ST_MPointFromWKB

Definition

ST_MPointFromText takes a well-known binary (WKB) representation of type ST_MultiPoint and a spatial reference ID and creates an ST_MultiPoint.

Syntax

Oracle

sde.st_mpointfromwkb (wkb blob, srid integer)

PostgreSQL

sde.st_mpointfromwkb (wkb bytea, srid integer)

SQLite

st_mpointfromwkb (wkb blob, srid int32)

Return type

ST_MultiPoint

Example

This example illustrates how ST_MPointFromWKB can be used to create a multipoint from its well-known binary representation. The geometry is a multipoint in spatial reference system 4326. In this example, the multipoint gets stored with ID = 10 in the GEOMETRY column of the SAMPLE_MPOINTS table, then the WKB column is updated with its well-known binary representation (using the ST_AsBinary function). Finally, the ST_MPointFromWKB function is used to return the multipoint from the WKB column. The SAMPLE_MPOINTS table has a GEOMETRY column, where the multipoint is stored, and a WKB column, where the multipoint's well-known binary representation is stored.

In the following SELECT statement, the ST_MPointFromWKB function is used to retrieve the multipoint from the WKB column.

Oracle

CREATE TABLE sample_mpoints (
 id integer,
 geometry sde.st_geometry,
 wkb blob
);

INSERT INTO SAMPLE_MPOINTS (id, geometry) VALUES (
 10,
 sde.st_multipoint ('multipoint (4 14, 35 16, 24 13)', 4326)
);

UPDATE SAMPLE_MPOINTS
 SET wkb = sde.st_asbinary (geometry)
 WHERE id = 10;
SELECT id, sde.st_astext (sde.st_mpointfromwkb (wkb,4326)) MULTI_POINT
 FROM SAMPLE_MPOINTS
 WHERE id = 10;


ID 	  MULTI_POINT 

10    MULTIPOINT (4.00000000 14.00000000, 35.00000000 16.00000000 24.00000000 13.00000000)

PostgreSQL

CREATE TABLE sample_mpoints (
 id integer,
 geometry sde.st_geometry,
 wkb bytea
);

INSERT INTO sample_mpoints (id, geometry) VALUES (
 10,
 sde.st_multipoint ('multipoint (4 14, 35 16, 24 13)', 4326)
);

UPDATE sample_mpoints
 SET wkb = sde.st_asbinary (geometry)
 WHERE id = 10;
SELECT id, sde.st_astext (sde.st_mpointfromwkb (wkb,4326)) 
 AS "MULTI_POINT"
 FROM sample_mpoints
 WHERE id = 10;


id 	  MULTI_POINT 

10     MULTIPOINT (4 14, 35 16, 24 13)

SQLite

CREATE TABLE sample_mpoints (
 id integer,
 wkb blob
);

SELECT AddGeometryColumn (
 NULL,
 'sample_mpoints',
 'geometry',
 4326,
 'multipointzm',
 'xyzm',
 'null'
);

INSERT INTO SAMPLE_MPOINTS (id, geometry) VALUES (
 10,
 st_multipoint ('multipoint (4 14, 35 16, 24 13)', 4326)
);

UPDATE sample_mpoints
 SET wkb = st_asbinary (geometry)
 WHERE id = 10;
SELECT id AS "ID",
 st_astext (st_mpointfromwkb (wkb,4326)) 
 AS "MULTI_POINT"
 FROM sample_mpoints
 WHERE id = 10;


ID 	  MULTI_POINT 

10    MULTIPOINT ( 4.00000000 14.00000000, 35.00000000 16.00000000, 24.00000000 13.00000000)

Related Topics

6/19/2015