Skip navigation links

Oracle® Spatial Java API Reference
11g Release 2 (11.2)
E11829-02


oracle.spatial.georaster
Class JGeoRaster

java.lang.Object
  extended by oracle.spatial.georaster.JGeoRaster


public class JGeoRaster
extends java.lang.Object

JGeoRaster is a Java class mapped to the Oracle Spatial GeoRaster SQL type MDSYS.SDO_GEORASTER, and it provides the capability to access, manipulate, and visualize the GeoRaster objects stored in an Oracle Spatial database.

Two constructors are defined in the class to allow users to initiate an instance based on different parameters:

         public JGeoRaster(STRUCT georaster) throws Exception
public JGeoRaster(Connection conn, String rasterDataTable, NUMBER rasterID) throws GeoRasterException

Here is sample code showing how to use these two constructors:

      /// reading a GeoRaster object from database based on a query
      ResultSet rs = statement.executeQuery("SELECT a.georaster FROM georaster_table a where a.georaster.rasterdatatable='RDT' and a.georaster.rasterid=1");
      STRUCT geor = (oracle.sql.STRUCT) rs.getObject(1);
      //convert STRUCT into JGeoRaster
      JGeoRaster j_geor = new JGeoRaster(geor);
      or 
      /// reading a GeoRaster object from database based on connection,RDT and rid.
      JGeoRaster j_geor = new JGeoRaster(conn,rasterDataTable,rasterID);

When a constructor is invoked to initiate a JGeoRaster object, the following tasks will be done in the init process:

 
      * Validate connection, rdt, and rid, and make sure they identify a valid GeoRaster object in the target database.
      * Fetch rasterType, spatialExtent, and schema/table/column name of the target Georaster object to 
        initiate attributes of JGeoRaster object. 
      * Fetch metadata XML string of the target Georaster object to initiate the contained JGeoRasterMeta object,
        for JGeoRasterMeta initiation, check class JGeoRasterMeta.
 

After a JGeoRaster is successfully initialized, the JGeoRaster object is associated with the corresponding GeoRaster object in the target database through RDT and rid, and it is also working as a root access point of all GeoRaster Java API operations, from which users can deal with different tasks, like:

      * Retrieving and updating metadata
      * Retrieving and updating raster data
      * Visualizing GeoRaster objects
      * Accessing the server-side PL/SQL API through JDBC

To get other GeoRaster Java objects from a JGeoRaster object:

      //get an instance of JGeoRasterMeta to deal with metadata
      public JGeoRasterMeta getMetadataObject()

      //get an instance of JRaster to deal with raster data
      public JRaster getRasterObject()
   
      //get an instance of GeoRasterImage to deal with visualization
      public GeoRasterImage getGeoRasterImageObject()
   
      //get an instance of SdoGeorPKG to access PL/SQL APIs in the package SOD_GEOR through JDBC
      public SdoGeorPKG getSdoGeorPKG()
 

Note that this class may not be synchronized with server-side changes.If one thread is reading this GeoRaster object and another is modifying it (such as changing its metadata), there may be inconsistencies. It is not synchronized with any raster data or metadata update through the SdoGeorPKG in the same thread either. In other words, the changes made by any other parties other than by the current JGeoRaster instance and its associated metadata and raster objects are not reflected in the current JGeoRaster instance.


Constructor Summary
JGeoRaster(java.sql.Connection conn, java.lang.String rasterDataTable, NUMBER rasterID)
          Constructs an GeoRaster object with given connection, rasterDataTable, and rasterID.
JGeoRaster(STRUCT georaster)
          Constructs an GeoRaster object with the given STRUCT.

 

Method Summary
 java.sql.Connection getConnection()
          Returns the connection object associated with current GeoRaster object.
 java.lang.String getGeoRasterColumn()
          Returns the column where the current GeoRaster is stored.
 GeoRasterImage getGeoRasterImageObject()
          Creates a GeoRasterImage object, which is an image rendering engine, and by which any portion (rectangle) of GeoRaster object can be retrieved as a renderable image.
 java.lang.String getGeoRasterTable()
          Returns the table where the current GeoRaster is stored.
 JGeoRasterMeta getMetadataObject()
          Returns the JGeoRasterMeta object contained in this JGeoRaster object.
 java.lang.String getRasterDataTable()
          Returns the raster data table where the current GeoRaster is stored.
 NUMBER getRasterID()
          Returns the raster ID assigned to the current GeoRaster.
 JRaster getRasterObject()
          Returns the JRaster object contained in this JGeoRaster object.
 int getRasterType()
          Returns the raster type.
 java.lang.String getSchemaName()
          Returns the schema where the current GeoRaster is stored.
 SdoGeorPKG getSdoGeorPKG()
          Returns a SdoGeorPKG object, which is used to remotely execute PL/SQL functions and procedures defined in the server-side package SDO_GEOR.
 JGeometry getSpatialExtent()
          Returns the spatial extent.
 void loadFromDB()
          Fetches data from GeoRaster object in the Oracle Database server, which is associated with current JGeoRaster object by RDT and RID, and reinitiates JGeoRaster instance with new data.
 void setRasterType(int rasterType)
          Sets the rasterType.
 void setSpatialExtent(JGeometry spatialExtent)
          Sets the spatial extent.
 void storeToDB()
          Updates the GeoRaster object in the Oracle Database server, which is associated with current JGeoRaster object by RDT and RID.
 boolean validate()
          Validates the current JGeoRaster object.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

JGeoRaster

public JGeoRaster(STRUCT georaster)
           throws java.lang.Exception
Constructs an GeoRaster object with the given STRUCT.
Parameters:
georaster - GeoRaster object
Throws:
java.lang.Exception

JGeoRaster

public JGeoRaster(java.sql.Connection conn,
                  java.lang.String rasterDataTable,
                  NUMBER rasterID)
           throws GeoRasterException
Constructs an GeoRaster object with given connection, rasterDataTable, and rasterID.
Parameters:
conn - connection to an oracle database
rasterDataTable - raster data table
rasterID - raster ID number
Throws:
GeoRasterException

Method Detail

getRasterType

public int getRasterType()
Returns the raster type.
Returns:
raster type.

setRasterType

public void setRasterType(int rasterType)
Sets the rasterType.
Parameters:
rasterType - raster type

getMetadataObject

public JGeoRasterMeta getMetadataObject()
Returns the JGeoRasterMeta object contained in this JGeoRaster object.
Returns:
JGeoRasterMeta object contained in this JGeoRaster object.

getRasterObject

public JRaster getRasterObject()
Returns the JRaster object contained in this JGeoRaster object.
Returns:
JRaster object contained in this JGeoRaster object.

getGeoRasterImageObject

public GeoRasterImage getGeoRasterImageObject()
Creates a GeoRasterImage object, which is an image rendering engine, and by which any portion (rectangle) of GeoRaster object can be retrieved as a renderable image.
Returns:
a GeoRasterImage object.

getSdoGeorPKG

public SdoGeorPKG getSdoGeorPKG()
Returns a SdoGeorPKG object, which is used to remotely execute PL/SQL functions and procedures defined in the server-side package SDO_GEOR.
Returns:
a SdoGeorPKG object.

getConnection

public java.sql.Connection getConnection()
Returns the connection object associated with current GeoRaster object.
Returns:
the connection object associated with current GeoRaster object.

getSchemaName

public java.lang.String getSchemaName()
Returns the schema where the current GeoRaster is stored.
Returns:
the schema where the current GeoRaster is stored.

getGeoRasterTable

public java.lang.String getGeoRasterTable()
Returns the table where the current GeoRaster is stored.
Returns:
the table where the current GeoRaster is stored.

getGeoRasterColumn

public java.lang.String getGeoRasterColumn()
Returns the column where the current GeoRaster is stored.
Returns:
the column where the current GeoRaster is stored.

getRasterDataTable

public java.lang.String getRasterDataTable()
Returns the raster data table where the current GeoRaster is stored.
Returns:
the raster data table where the current GeoRaster is stored.

getRasterID

public NUMBER getRasterID()
Returns the raster ID assigned to the current GeoRaster.
Returns:
the raster ID assigned to the current GeoRaster.

setSpatialExtent

public void setSpatialExtent(JGeometry spatialExtent)
Sets the spatial extent.

getSpatialExtent

public JGeometry getSpatialExtent()
Returns the spatial extent.
Returns:
spatial extent as a JGeometry.

storeToDB

public void storeToDB()
               throws java.lang.Exception
Updates the GeoRaster object in the Oracle Database server, which is associated with current JGeoRaster object by RDT and RID. All changes are based on changes in the current JGeoRaster object in the Java side.
Throws:
java.lang.Exception

loadFromDB

public void loadFromDB()
                throws GeoRasterException
Fetches data from GeoRaster object in the Oracle Database server, which is associated with current JGeoRaster object by RDT and RID, and reinitiates JGeoRaster instance with new data.
Throws:
GeoRasterException

validate

public boolean validate()
                 throws java.lang.Exception
Validates the current JGeoRaster object.
Returns:
true or false to indicate if current JGeoRaster is valid.
Throws:
java.lang.Exception

Skip navigation links

Oracle® Spatial Java API Reference
11g Release 2 (11.2)
E11829-02


Copyright © 2007, 2011, Oracle and/or its affiliates. All Rights Reserved.