HiRISE

HiRISE.HiCat.Utilities
Class CRISM_Shapefile_Loader

java.lang.Object
  extended by HiRISE.HiCat.Utilities.CRISM_Shapefile_Loader

public class CRISM_Shapefile_Loader
extends Object

CRISM_Shapefile_Loader Loads information about CRISM footprints from provided ESRI Shape files.

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.

Version:
1.11

Author:
Sean Whitsitt - UA/PIRL

Field Summary
static String CONFIG_GROUP
          The default configuration group name
static String CONFIG_PARAM_CATALOG
          The default configuration parameter name for the catalog
static String CONFIG_PARAM_TABLE
          The default configuration parameter name for the table
static 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 String FIELD_MAPPING_GROUP
          The default field mappings group name
static String ID
          The Class identification with revision number and date.
 
Constructor Summary
CRISM_Shapefile_Loader()
           
 
Method Summary
static void main(String[] arguments)
          Run the CRISM_Shapefile_Loader application.
static String PDS_To_MYSQL_Datetime(String pds)
          This method will convert a pds datetime to a mysql datetime
static void Usage()
          Command line usage syntax.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
The Class identification with revision number and date.

See Also:
Constant Field Values

DEFAULT_CONFIGURATION_FILENAME

public static final String DEFAULT_CONFIGURATION_FILENAME
The default configuration file name

See Also:
Constant Field Values

DEFAULT_FOOTPRINT_SAMPLE_RATE

public static final int DEFAULT_FOOTPRINT_SAMPLE_RATE
The sampling rate used to select points from the CRISM footprint to create a simplified footprint polygon.

See Also:
Constant Field Values

CONFIG_GROUP

public static final String CONFIG_GROUP
The default configuration group name

See Also:
Constant Field Values

FIELD_MAPPING_GROUP

public static final String FIELD_MAPPING_GROUP
The default field mappings group name

See Also:
Constant Field Values

CONFIG_PARAM_CATALOG

public static final String CONFIG_PARAM_CATALOG
The default configuration parameter name for the catalog

See Also:
Constant Field Values

CONFIG_PARAM_TABLE

public static final String CONFIG_PARAM_TABLE
The default configuration parameter name for the table

See Also:
Constant Field Values

EXIT_SUCCESS

public static final int EXIT_SUCCESS
Application exit status for success.

See Also:
Constant Field Values

EXIT_COMMAND_LINE_SYNTAX_ERROR

public static final int EXIT_COMMAND_LINE_SYNTAX_ERROR
Application exit status for a command line syntax error

See Also:
Constant Field Values

EXIT_CONFIGURATION_ERROR

public static final int EXIT_CONFIGURATION_ERROR
Application exit status for a confiugration error

See Also:
Constant Field Values

EXIT_DATABASE_ERROR

public static final int EXIT_DATABASE_ERROR
Application exit status for a database error

See Also:
Constant Field Values
Constructor Detail

CRISM_Shapefile_Loader

public CRISM_Shapefile_Loader()
Method Detail

main

public static void main(String[] arguments)
Run the CRISM_Shapefile_Loader application.

Exit status values:

EXIT_SUCCESS
All operations succeeded.
EXIT_COMMAND_LINE_SYNTAX_ERROR
Operation failed while processing command line arguments.
EXIT_CONFIGURATION_ERROR
Operation failed while processing configuration.
EXIT_DATABASE_ERROR
Operation failed while processing the database.

Parameters:
arguments - The command line arguments.

PDS_To_MYSQL_Datetime

public static String PDS_To_MYSQL_Datetime(String pds)
This method will convert a pds datetime to a mysql datetime

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"

Parameters:
pds - The PDS datetime String
Returns:
The mysql datetime String

Usage

public static void Usage()
Command line usage syntax.
Usage:
        CRISM_Shapefile_Loader
                [<Options>] [Shapefiles...]
    [-Verbose]
    [-Help]
    [-CAtalog <catalog>]
    [-COnfiguration <file>]
    [-Icrement <increment value>]
    [-Server <server>]
    [-Table <table>]

Verbose:

Prints verbose information to the command line.

This prints the programs ID and all output from sub-programs.

Help:

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.

Catalog:

Configuration:

Specifies the configuration file name. If not specified DEFAULT_CONFIGURATION_FILENAME is used.

Increment:

Specifies the incremental rate at which points are sampled from the CRISM footprint.

Server:

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.

Table:

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.


HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona