ST_SHAPEFILE_INFO procedure
Use this stored procedure to display information about a shapefile and its contents.
Authorization
The owner of the Db2® instance must have the necessary privileges on the server machine to read the input files and write error files.
Syntax
Parameter descriptions
- file_name
- The fully qualified name, with or without a file extension, of the shapefile for which
information is to be retrieved and displayed. If you do not specify a file extension, the routine
looks first for a file with the extension .shp, and then for a file with the
extension .SHP.
See Usage notes for a list of required files.
The data type of this parameter is VARCHAR(256).
Output parameters
- shapefile_info
- Information about the specified shapefile.
The data type of this output parameter is VARCHAR(32K).
- msg_code
- The message code that is returned from the stored procedure. The value of this output parameter
identifies the error, success, or warning condition that was encountered during the processing of
the procedure. If this parameter value is for a success or warning condition, the procedure finished
its task. If the parameter value is for an error condition, no changes to the database were
performed.
The data type of this output parameter is INTEGER.
- msg_text
- The message text, associated with the message code, that is returned from the stored procedure.
The message text can include additional information about the success, warning, or error condition,
such as where an error was encountered.
The data type of this output parameter is VARCHAR(1024).
Usage notes
The ST_SHAPEFILE_INFO stored procedure uses up to 4 different files:
- A main shapefile, which has the extension .shp. This file is mandatory.
- A shape index file, which has the extension .shx. This file is optional.
- A dBASE file, which contains attribute data and has the extension .dbf. This file is optional.
- A projection file, which specifies the coordinate system of the shape data and has the extension
.prj. This file is optional. If this file is present, the coordinate system
that is defined in it is compared with the coordinate system of the spatial reference system that is
specified by the
srs_id
parameter.
Example
This example uses a Db2 CALL command to
display information about a shapefile named
/tmp/officesShape
:
call ST_SHAPEFILE_INFO('/tmp/officesShape.shp',?,?,?)"
The 3 question marks at the end of this CALL command represent the output parameters
shapefile_info, msg_code, and
msg_text. The values for these output parameters are displayed after the
stored procedure runs, for
example:
Value of output parameters
--------------------------
Parameter Name : OUTPUTSHAPEINFO
Parameter Value :
Shape file information
----------------------
File code = 9994
File length (16-bit words) = 40790
Shape file version = 1000
Shape type = 5 (ST_MULTIPOLYGON)
Number of records = 239
Minimum X coordinate = -121.961900
Maximum X coordinate = -121.813700
Minimum Y coordinate = 37.258500
Maximum Y coordinate = 37.401600
Shapes do not have Z coordinates.
Shapes do not have M coordinates.
Shape index file (extension .shx) is present.
Attribute file information
--------------------------
dBase file code = 3
Date of last update = 2001-08-08
Number of records = 239
Number of bytes in header = 321
Number of bytes in each record = 116
Number of columns = 9
Column Number Column Name Data Type Length Decimal
------------- --------------- -------------- ------ -------
1 BLOCKGROUP C ( Character) 20 0
2 POPULATION N ( Numeric) 14 0
3 HOUSEHO_28 N ( Numeric) 9 0
4 HOUSEHO_29 N ( Numeric) 9 0
5 PER_CAPITA N ( Numeric) 9 0
6 MEDIAN_HOU N ( Numeric) 9 0
7 MEDIAN_FAM N ( Numeric) 9 0
8 AVERAGE__1 N ( Numeric) 19 0
9 AVERAGE__2 N ( Numeric) 17 0
Coordinate system definition: "GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]"
Compatible coordinate systems
-----------------------------
GCS_NORTH_AMERICAN_1983
Compatible spatial reference systems
------------------------------------
1 NAD83_SRS_1
4269 NAD83_SRS_4269
Parameter Name : MSGCODE
Parameter Value : 0
Parameter Name : MSGTEXT
Parameter Value : GSE0000I The operation was completed successfully.
Return Status = 0