コード例 #1
0
ファイル: SHPRead.java プロジェクト: nicolas-f/h2gis
 /**
  * Copy data from Shape File into a new table in specified connection.
  *
  * @param connection Active connection
  * @param tableReference [[catalog.]schema.]table reference
  * @param fileName File path of the SHP file or URI
  * @param forceEncoding Use this encoding instead of DBF file header encoding property.
  */
 public static void readShape(
     Connection connection, String fileName, String tableReference, String forceEncoding)
     throws IOException, SQLException {
   File file = URIUtility.fileFromString(fileName);
   if (!file.exists()) {
     throw new FileNotFoundException("The following file does not exists:\n" + fileName);
   }
   SHPDriverFunction shpDriverFunction = new SHPDriverFunction();
   shpDriverFunction.importFile(
       connection,
       TableLocation.parse(tableReference, true).toString(true),
       file,
       new EmptyProgressVisitor(),
       forceEncoding);
 }
コード例 #2
0
ファイル: SHPRead.java プロジェクト: nicolas-f/h2gis
 /**
  * Copy data from Shape File into a new table in specified connection. The newly created table is
  * given the same name as the filename without the ".shp" extension. If such a table already
  * exists, an exception is thrown.
  *
  * @param connection Active connection
  * @param fileName File path of the SHP file or URI
  */
 public static void readShape(Connection connection, String fileName)
     throws IOException, SQLException {
   final String name = URIUtility.fileFromString(fileName).getName();
   readShape(connection, fileName, name.substring(0, name.lastIndexOf(".")).toUpperCase());
 }