Guide d'utilisation et de référence

MPointFromShape

MPointFromShape utilise en entrée une forme de type multipoint et un identificateur de système de références spatiales, et renvoie un multipoint.

Syntaxe

db2gse.MPointFromShape(ShapeMultiPoint (1M), SRID db2gse.coordref)

Type de retour

db2gse.ST_MultiPoint

Exemples

Le fragment de code ci-après peuple la table SPECIES_SITINGS d'un biologiste.

La table SPECIES_SITINGS est créée avec trois colonnes. Les colonnes SPECIES et GENUS identifient de manière univoque chaque ligne de la table alors que le multipoint de la colonne SITINGS représente les lieux d'implantation de l'espèce.

CREATE TABLE SPECIES_SITINGS (species  varchar(32),
                              genus varchar(32),
                              sitings  db2gse.ST_MultiPoint);
 
/* Create the SQL insert statement to populate the species, genus and
   sitings. The question marks are parameter markers that indicate the
   name and water values that will be retrieved at runtime. */
strcpy (shp_sql,"insert into SPECIES_SITINGS (species,genus,sitings)
values (?,?, db2gse.MPointFromShape (cast(? as blob(1m)),
db2gse.coordref()..srid(0)))");
 
/* Allocate memory for the SQL statement handle and associate the
   statement handle with the connection handle. */
rc = SQLAllocStmt (handle, &hstmt);
 
/* Prepare the SQL statement for execution. */
rc = SQLPrepare (hstmt, (unsigned char *)shp_sql, SQL_NTS);
 
/* Bind the varchar species value to the first parameter. */
pcbvalue1 = species_len;
rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
     SQL_CHAR, species_len, 0, species, species_len, &pcbvalue1);
 
/* Bind the varchar genus value to the second parameter. */
pcbvalue2 = genus_len;
rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR,
   SQL_CHAR, genus_len, 0, name, genus_len, &pcbvalue2);
 
/* Bind the shape to the third parameter. */
pcbvalue3 = blob_len;
rc = SQLBindParameter (hstmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY,
     SQL_BLOB, sitings_len, 0, sitings_shape, sitings_len, &pcbvalue3);
 
/* Execute the insert statement. */
rc = SQLExecute (hstmt);


[ Début de page | Page précédente | Page suivante | Table des matières | Index ]