public class CRISM_Shapefile_Loader
extends java.lang.Object
This utility will load information from files specified on the command line. The files
should be specified in the same manner as required by the FeatureProvider
class's
load()
method.
Currently this means the full pathname of the file and the file name without an extension are
required. Valid .shp file, .shx file, and .dbf file are required to be at the location with the given
file name. For example, an input of "~/shapefiles/example" would require the following files to
be in the "~/shapefiles/" directory:
example.dbf
example.shp
example.shx
At least one shapefile set must be specified and there is no limit to the number of specified shapefiles.
A configuration file for this utility must be specified. The default filename is DEFAULT_CONFIGURATION_FILENAME
but the filename may be specified in the command line
options. The configuration file must at least specify connection information for
a MySQL server. If no server name is specified in the command line options then the
first server listed in the configuration file will be used. Additionally, a table
name and a catalog name may be specified either on the command line or in the
configuration file. Both the table name and catalog name must be specified in the
CONFIG_GROUP
of the configuration file. For any option that may be
specified on the command line or in the configuration file, specifying it on the command
line will override the value in the configuration file.
The configuration file must also contain a group FIELD_MAPPING_GROUP
within
the CONFIG_GROUP
which should contain the mappings of fields from the shape file
to the mysql database. These will be of the form:
mysql field = shape file field
Below is a sample configuration file with all options specified
Server = hicat
Group = hicat
Type = MySQL
Host = pirldb
User = whitsitt
Password = ########
End_Group
Group = CRISM_Shapefile_Loader
Catalog = HiRISE_Sean
Table = CRISM
Group = Field_Mappings
observation_type = obsclass
start_time = start_time
stop_time = stop_time
observation_id = obs_id
sensor_id = sensor_id
image_lines = lines
line_samples = samples
spacecraft_clock_start_count = start_sclk
spacecraft_clock_stop_count = stop_sclk
End_Group
End_Group
Additionally, fields will be created for the center and bounding box coordinates. These will be filled with information from the shape file automatically. A GIS polygon field for the footprint and a GIS point field for the center will also be filled out.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG_GROUP
The default configuration group name
|
static java.lang.String |
CONFIG_PARAM_CATALOG
The default configuration parameter name for the catalog
|
static java.lang.String |
CONFIG_PARAM_TABLE
The default configuration parameter name for the table
|
static java.lang.String |
DEFAULT_CONFIGURATION_FILENAME
The default configuration file name
|
static int |
DEFAULT_FOOTPRINT_SAMPLE_RATE
The sampling rate used to select points from the CRISM footprint to create
a simplified footprint polygon.
|
static int |
EXIT_COMMAND_LINE_SYNTAX_ERROR
Application exit status for a command line syntax error
|
static int |
EXIT_CONFIGURATION_ERROR
Application exit status for a confiugration error
|
static int |
EXIT_DATABASE_ERROR
Application exit status for a database error
|
static int |
EXIT_SUCCESS
Application exit status for success.
|
static java.lang.String |
FIELD_MAPPING_GROUP
The default field mappings group name
|
static java.lang.String |
ID
The Class identification with revision number and date.
|
Constructor and Description |
---|
CRISM_Shapefile_Loader() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] arguments)
Run the CRISM_Shapefile_Loader application.
|
static java.lang.String |
PDS_To_MYSQL_Datetime(java.lang.String pds)
This method will convert a pds datetime to a mysql datetime
|
static void |
Usage()
Command line usage syntax.
|
public static final java.lang.String ID
public static final java.lang.String DEFAULT_CONFIGURATION_FILENAME
public static final int DEFAULT_FOOTPRINT_SAMPLE_RATE
public static final java.lang.String CONFIG_GROUP
public static final java.lang.String FIELD_MAPPING_GROUP
public static final java.lang.String CONFIG_PARAM_CATALOG
public static final java.lang.String CONFIG_PARAM_TABLE
public static final int EXIT_SUCCESS
public static final int EXIT_COMMAND_LINE_SYNTAX_ERROR
public static final int EXIT_CONFIGURATION_ERROR
public static final int EXIT_DATABASE_ERROR
public static void main(java.lang.String[] arguments)
Exit status values:
EXIT_SUCCESS
EXIT_COMMAND_LINE_SYNTAX_ERROR
EXIT_CONFIGURATION_ERROR
EXIT_DATABASE_ERROR
arguments
- The command line
arguments.public static java.lang.String PDS_To_MYSQL_Datetime(java.lang.String pds)
The format seen in the PDS imaging data volumes is "yyyy-mm-ddThh:mm:ss.sss" which this method converts to the format "yyyy-mm-dd hh:mm:ss"
pds
- The PDS datetime Stringpublic static void Usage()
Usage: CRISM_Shapefile_Loader [<Options>] [Shapefiles...] [-Verbose] [-Help] [-CAtalog <catalog>] [-COnfiguration <file>] [-Icrement <increment value>] [-Server <server>] [-Table <table>]
Prints verbose information to the command line.
This prints the programs ID and all output from sub-programs.
The command line syntax usage is listed and the program exits. N.B.: If the -Help option occurs anywhere on the command line no other command line argument will be used. If the command line is empty the usage will be listed.
N.B. The usage is printed to stderr. This method always results in
a System.exit with a status of
.
EXIT_COMMAND_LINE_SYNTAX_ERROR
Specifies the configuration file name. If not specified DEFAULT_CONFIGURATION_FILENAME
is used.
Specifies the incremental rate at which points are sampled from the CRISM footprint.
Specifies the server name to look up in the configuration file for connection information. If not specified then the first server name to appear in the configuration file is used.
Specfies the table name to load information from the shape files into. If not specified
then a value labeled Table must be present in the CONFIG_GROUP
group in the
configuration file.
Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona