diff --git a/src/main/java/mil/nga/geopackage/io/SQLExec.java b/src/main/java/mil/nga/geopackage/io/SQLExec.java index a9e1939d..f134103a 100644 --- a/src/main/java/mil/nga/geopackage/io/SQLExec.java +++ b/src/main/java/mil/nga/geopackage/io/SQLExec.java @@ -334,6 +334,11 @@ public class SQLExec { */ public static final String ARGUMENT_BOUNDS_MANUAL = "m"; + /** + * R-tree geodesic argument + */ + public static final String ARGUMENT_RTREE_GEODESIC = "g"; + /** * R-tree drop argument */ @@ -1256,9 +1261,13 @@ private static void printHelp(GeoPackage database) { System.out.println("\t" + COMMAND_EXTENSIONS + " [name] - List GeoPackage extensions (all or LIKE table name)"); System.out.println("\t" + COMMAND_RTREE + " [" + ARGUMENT_PREFIX + + ARGUMENT_RTREE_GEODESIC + "|" + ARGUMENT_PREFIX + ARGUMENT_RTREE_DROP + "] "); System.out.println( "\t - Create, recreate, or drop a feature table R-tree"); + System.out + .println("\t " + ARGUMENT_RTREE_GEODESIC + + " - index using geodesic bounds"); System.out.println("\t " + ARGUMENT_RTREE_DROP + " - drop the R-tree if it exists"); System.out.println( @@ -2455,6 +2464,7 @@ private static void rtree(GeoPackage database, StringBuilder sqlBuilder, boolean valid = true; String tableName = null; boolean drop = false; + boolean geodesic = false; for (int i = 0; valid && i < parts.length; i++) { @@ -2466,6 +2476,10 @@ private static void rtree(GeoPackage database, StringBuilder sqlBuilder, switch (argument) { + case ARGUMENT_RTREE_GEODESIC: + geodesic = true; + break; + case ARGUMENT_RTREE_DROP: drop = true; break; @@ -2495,8 +2509,14 @@ private static void rtree(GeoPackage database, StringBuilder sqlBuilder, } } + if (geodesic && drop) { + valid = false; + System.out.println("Error: Unsupported combination of arguments"); + } + if (valid) { - RTreeIndexExtension extension = new RTreeIndexExtension(database); + RTreeIndexExtension extension = new RTreeIndexExtension(database, + geodesic); RTreeIndexTableDao dao = extension.getTableDao(tableName); boolean exists = dao.has(); System.out.println(); @@ -2508,7 +2528,8 @@ private static void rtree(GeoPackage database, StringBuilder sqlBuilder, if (!drop) { dao.create(); System.out.println( - "R-tree created for table '" + tableName + "'"); + "R-tree created" + (geodesic ? " (geodesic)" : "") + + " for table '" + tableName + "'"); } else if (!exists) { System.out.println("No R-tree exists to drop for table '" + tableName + "'");