Complemento Oracle GeoRaster

In Oracle databases, raster data can be stored in SDO_GEORASTER objects available with the Oracle Spatial extension. In QGIS, the oracle_raster OracleGeoRasterPlugin is supported by GDAL, and depends on Oracle’s database product being installed and working on your machine. While Oracle is proprietary software, they provide their software free for development and testing purposes. Here is one simple example of how to load raster images to GeoRaster:

$ gdal_translate -of georaster input_file.tif geor:scott/tiger@orcl

This will load the raster into the default GDAL_IMPORT table, as a column named RASTER.

Gerenciando conexões

Firstly, the Oracle GeoRaster Plugin must be enabled using the Plugin Manager (see Section Loading a QGIS Core Plugin). The first time you load a GeoRaster in QGIS, you must create a connection to the Oracle database that contains the data. To do this, begin by clicking on the oracle_raster Select GeoRaster toolbar button, it will open the Select Oracle Spatial GeoRaster dialog window. Click on [New] to open the dialog window, and specify the connection parameters (See Figure_oracle_raster_1):

  • Name: Enter a name for the database connection
  • Database instance: Enter the name of the database that you will connect to
  • Username: Specify your own username that you will use to access the database
  • Password: The password associated with your username that is required to access the database

Figure Oracle Raster 1:

../../../_images/oracle_create_dialog.png

Create Oracle connection dialog

Now, back on the main Oracle Spatial GeoRaster dialog window (see Figure_oracle_raster_2), use the drop-down list to choose one connection, and use the [Connect] button to establish a connection. You may also [Edit] the connection by opening the previous dialog and making changes to the connection information, or use the [Delete] button to remove the connection from the drop-down list.

Selecionando um GeoRaster

Uma vez a conexão estabelecida, a janela de subconjunto de dados mostra os nomes de todas as tabelas que contêm colunas GeoRaster naquele banco de dados no formato de um nome de subconjunto de dados GDAL.

Clique em um dos subconjuntos de dados listados e em seguida clique em [Selecione] para escolher um nome de tabela. Agora outra lista de subconjunto de dados vai ser mostrada com os nomes de colunas GeoRaster naquela tabela. É geralmente uma lista pequena, já que a maioria dos usuários não terá mais do que uma ou duas colunas GeoRaster na mesma tabela.

Clique em um dos subconjuntos de dados e aí clique em [Selecione] para escolher uma das combinações da tabela/coluna. A janela não mostrará todas as linhas que contêm objetos GeoRaster. Note que a lista de subconjunto de dados não mostrará a Tabela de Dados Raster e pares de Raster Id’s.

A qualquer momento a entrada de Seleção pode ser editada a fim de ir diretamente a um GeoRaster conhecido ou voltar ao início e selecionar outro nome de tabela.

Figure Oracle Raster 2:

../../../_images/oracle_select_dialog.png

Select Oracle GeoRaster dialog

The Selection data entry can also be used to enter a WHERE clause at the end of the identification string, e.g. geor:scott/tiger@orcl,gdal_import,raster,geoid=. See http://www.gdal.org/frmt_georaster.html for more information.

Mostrando GeoRaster

Finally, by selecting a GeoRaster from the list of Raster Data Table and Raster Id’s, the raster image will be loaded into QGIS.

The Select Oracle Spatial GeoRaster dialog can be closed now and next time it opens it will keep the same connection, and will show the same previous list of subdataset making it very easy to open up another image from the same context.

Nota

GeoRasters that contains pyramids will display much faster but the pyramids need to be generated outside of QGIS using Oracle PL/SQL or gdaladdo.

The following is example using gdaladdo:

gdaladdo georaster:scott/tiger@orcl,georaster\_table,georaster,georid=6 -r nearest 2 4 6 8 16 32

This is an example using PL/SQL:

$ sqlplus scott/tiger
SQL> DECLARE
 gr sdo_georaster;
BEGIN
    SELECT image INTO gr FROM cities WHERE id = 1 FOR UPDATE;
    sdo_geor.generatePyramid(gr, 'rLevel=5, resampling=NN');
    UPDATE cities SET image = gr WHERE id = 1;
    COMMIT;
END;