使用者の手引きおよび解説書

LineFromShape

LineFromShape はポイント型の輪郭および地理情報参照システム ID を引き数として、折れ線を戻します。

構文

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

戻りタイプ

db2gse.ST_LineString

以下のコード断片では、SEWERLINES 表に、それぞれの下水路の固有の ID、サイズ・クラス、および図形を入れます。

以下の CREATE TABLE ステートメントによって SEWERLINES 表が作成されます。この表には 3 つの列があります。最初の列である SEWER_ID は、それぞれの下水路を一意的に識別します。 2 番目の列である CLASS は整数タイプで、下水路のタイプを識別します。通常は下水路の容量と関連付けられています。 3 番目の列である SEWER は折れ線タイプで、下水路の図形を格納します。

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


[ ページのトップ | 前ページ | 次ページ | 目次 | 索引 ]