Using the Java import utility¶
The classpath for the utility is set in the manifest file of
gt-imagemosiac-jdbc.jar, so you
do not need to bother about dependencies.
The only problem are the JDBC drivers for the the database. First you need to download the jar files.
DB2
We need
db2jcc.jaranddb2jcc_license.jar. Download from:https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&source=swg-idsjs11
Oracle
We need
ojdbc14.jar, download from:http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
Postgis
MySql
Other DB Systems
Google is your friend.
The problem is to put the jars in the classpath. According to the Sun documentation:
http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html
a class path in a manifest overrides the CLASSPATH environment variable and the
-cpor-classpathjava option.
Solutions:
A solution is to copy the jar files into
/lib/extof your java runtime. In this case the extension class loader is responsible to load your jdbc drivers.Another approach is to investigate into the
-Xoptions of your java runtime. java-Xgives help. if there is an option-Xbootclasspath/a:you can avoid copying the jdbc jar file into the /lib/ext directory and calljava -Xbootclasspath/a:<location of jdbc.jar> -jar ....
Call Syntax¶
Common options:
-configthe URL or the file name of the XML configuration file , e.g
file:/temp/mymap.xml-commitCount(optional), default 100, insert records in chunks to improve performance
Importing exactly one level
-spatialTNthe name of the spatial table which must already exist
-tileTNthe name of the tile table which must already exist. When using a joined table, the tile table name has to be equal to the spatial table name
Importing all tiles including the pyramids as produced by gdal_retile.py
-spatialTNPrefixthe prefix of spatial table names (produced by the ddl generation utility)
-tileTNPrefixthe prefix of tiles table names (produced by the ddl generation utility)
To import the output of gdal_retile.p using world files (one level):
java -jar gt-imagemosaic-jdbc.jar import -config URLOrFileName -spatialTN spatialTableName -tileTN tileTableName
[-commitCount commitCount] -dir dir -ext extension
To import the output of gdal_retile.py using world files (all levels):
java -jar gt-imagemosaic-jdbc.jar import -config URLOrFileName -spatialTNPrefix spatialTableNamePrefix
-tileTNPrefix tileTableNamePrefix [-commitCount commitCount] -dir dir -ext extension
Options
-dirThe directory containing tiles
-extThe file extension (
png,jpg,tif,..). The extension must have exactly 3 chars. The world files must have an extension of “wld” or an extension according to the standard for building word files (removing the 2 character and appending a ‘w’).image.tif -> image.tfw,image.png -> image.pgw,….
To import the output of gdal_retile.py using a shape file (one level):
java -jar gt-imagemosaic-jdbc.jar import -config URLOrFileName -spatialTN spatialTableName -tileTN tileTableName
[-commitCount commitCount] -shape shapeURLOrFileName -shapeKeyField shapeKeyField
To import the output of gdal_retile.py using a shape file (all levels):
java -jar gt-imagemosaic-jdbc.jar import -config URLOrFileName -spatialTNPrefix spatialTableNamePrefix -tileTNPrefix tileTableNamePrefix
[-commitCount commitCount] -shape shapeURLOrFileName -shapeKeyField shapeKeyField
Options
-shapethe URL or the file name of the shape file , e.g “file:/temp/index.shp”
-shapeKeyFieldthe name of the attribute in the shape file holding the file names for the tiles
To import the output of gdal_retile.py using a CSV file (one level):
java -jar gt-imagemosaic-jdbc.jar import -config URLOrFileName -spatialTN spatialTableName -tileTN tileTableName
[-commitCount commitCount] -csv csvURLOrFileName -csvDelim csvDelim
To import the output of gdal_retile.p using a CSV file (all levels):
java -jar gt-imagemosaic-jdbc.jar import -config URLOrFileName -spatialTNPrefix spatialTableNamePrefix -tileTNPrefix tileTableNamePrefix
[-commitCount commitCount] -csv csvURLOrFileName -csvDelim csvDelim
Options
-csvthe URL or the file name of the CSV file , e.g “
file:/temp/index.csv”-csvDelimThe column delimiter in the CSV file.
The CSV file has exactly 5 columns.
Filename of the tile
minxmaxxminymaxy
Ensure using a point as decimal separator and do not use grouping separators for the coordinates. “12345.6789” is OK, “12.345,6789” is not supported.
A CSV example:
oek4000_1_1.tif;109546.250000;429601.536800;333297.122340;573436.750000
oek4000_1_2.tif;429601.536800;688046.180892;333297.122340;573436.750000
oek4000_2_1.tif;109546.250000;429601.536800;272461.750000;333297.122340
oek4000_2_2.tif;429601.536800;688046.180892;272461.750000;333297.122340