================================================================= SAMPLE PROGRAMS FOR SPATIAL JAVA API VERSION 1.00, IBM INFORMIX SPATIAL DATABLADE MODULE, VERSION 8.20 DATE: 06/15/2002 ================================================================= Several example Java programs are provided to demonstrate how to create and use geometry objects. The example programs have been tested with IBM Informix Dynamic Server 9.30, IBM Informix JDBC Driver 2.21.JC2, and Spatial DataBlade 8.11 and 8.20. GeometryToWKT ----------------- Reads geometry objects from an IBM Informix spatial table and converts them into WKT (well-known text) strings. The program first creates a table, inserts geometry data, then queries the table. The output of this program shows the well-known text representation of sample geometries. GeometryToArray ---------------- Creates new geometries using a geometry factory, then reads coordinate data out of the geometry objects. The program first creates several geometry objects and stores them in a Java vector, then uses two techniques to read coordinate data out of the geometry objects: - IfxGeometry.toCoordArray() - IfxGeometry.toPointArray() CoordRefCreate --------------- Creates new coordinate reference objects and inserts them into the SPATIAL_REFERENCES table. The program creates a new CoordRef object, then serializes it as a new SRS row into the SPATIAL_REFERENCES table. The output of this program shows the result of a query to retrieve the new spatial reference systems from the database. Setting your Classpath ------------------------ When compiling or running any of these programs, set your CLASSPATH environment variable to include the Informix JDBC driver, the Spatial Java API jar file, and the directory where these programs are located. Compiling the programs ----------------------- You can compile these programs by using the javac command. (Be sure that your CLASSPATH is set correctly). For example, to compile all the programs, go to the samples directory and enter the following command: javac *.java Running the programs --------------------- java jdbc:informix-sqli://:/:informixserver=;user=;password= where = name of the class you want to execute = hostname of the computer where IBM Informix Server is running = port number that Informix server is listening on = name of the database in which Spatial DataBlade is registered = INFORMIXSERVER name = your database user name = your database password