Benutzer- und Referenzhandbuch

LineFromShape

LineFromShape verwendet eine Form des Typs Point (Punkt) und die Identität eines räumlichen Bezugssystems und gibt eine Linienfolge (Linestring) zurück.

Syntax

db2gse.Line FromShape(ShapeLineString Blob(1M), cr db2gse.coordref)

Rückgabetyp

db2gse.ST_LineString

Beispiele

Der folgende Codeabschnitt füllt die Tabelle SEWERLINES mit der eindeutigen ID, der Größenklasse und der Geometrie aller Abwasserkanallinien auf.

Die Anweisung CREATE TABLE erstellt die Tabelle SEWERLINES mit drei Spalten. Die erste Spalte, SEWER_ID, kennzeichnet jede Abwasserkanallinie eindeutig. Die zweite Spalte CLASS des Typs Integer kennzeichnet den Typ des Abwasserkanals; normalerweise gibt diese Spalte die Kapazität des Kanals an. Die dritte Spalte, SEWER, des Typs Linienfolge speichert die Geometrie der Abwasserkanallinie.

CREATE TABLE SEWERLINES (sewer_id   integer, class  integer,
                         sewer db2gse.ST_LineString);
 
/* Create the SQL insert statement to populate the sewer_id, size class and
   the sewer linestring. The question marks are parameter markers that
   indicate the sewer_id, class and sewer geometry values that will be
   retrieved at runtime. */
strcpy (shp_sql,"insert into sewerlines (sewer_id,class,sewer)
values (?,?, db2gse.Line FromShape (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 integer key value to the first parameter. */
pcbvalue1 = 0;
rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG,
   SQL_INTEGER, 0, 0, &sewer_id, 0, &pcbvalue1);
 
/* Bind the integer class value to the second parameter. */
pcbvalue2 = 0;
rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG,
   SQL_INTEGER, 0, 0, &sewer_class, 0, &pcbvalue2);;
 
/* Bind the shape to the third parameter. */
pcbvalue3 = blob_len;
rc = SQLBindParameter (hstmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY,
     SQL_BLOB, blob_len, 0, sewer_shape, blob_len, &pcbvalue3);
 
/* Execute the insert statement. */
rc = SQLExecute (hstmt);


[ Seitenanfang | Vorherige Seite | Nächste Seite | Inhaltsverzeichnis | Index ]