mil.nga.geopackage.GeoPackageConstants Java Examples

The following examples show how to use mil.nga.geopackage.GeoPackageConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeoPackageManagerTest.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * Test create attempt with no file extension
 * 
 * @throws IOException
 */
@Test
public void testCreateNoExtension() throws IOException {

	File testFolder = folder.newFolder();
	File dbFile = new File(testFolder, TestConstants.TEST_DB_NAME);

	// Create
	assertTrue("Database failed to create",
			GeoPackageManager.create(dbFile));
	assertTrue(
			"Database does not exist",
			GeoPackageIOUtils.addFileExtension(dbFile,
					GeoPackageConstants.EXTENSION).exists());

	// Open
	GeoPackage geoPackage = GeoPackageManager.open(dbFile);
	assertNotNull("Failed to open database", geoPackage);
	geoPackage.close();
}
 
Example #2
Source File: WebPExtensionTest.java    From geopackage-android with MIT License 6 votes vote down vote up
/**
 * Test the WebP Extension creation
 */
@Test
public void testWebPExtension() throws Exception {

    WebPExtension webpExtension = new WebPExtension(geoPackage);

    String tableName = "table";

    Extensions extension = webpExtension.getOrCreate(tableName);
    assertNotNull(extension);
    assertTrue(webpExtension.has(tableName));

    assertEquals(extension.getExtensionName(), WebPExtension.EXTENSION_NAME);
    assertEquals(extension.getAuthor(),
            GeoPackageConstants.EXTENSION_AUTHOR);
    assertEquals(extension.getExtensionNameNoAuthor(), WebPExtension.NAME);
    assertEquals(extension.getTableName(), tableName);
    assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_DATA);
    assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE);
    assertEquals(extension.getDefinition(), WebPExtension.DEFINITION);

    GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName);
    assertFalse(webpExtension.has(tableName));

}
 
Example #3
Source File: WebPExtensionTest.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * Test the WebP Extension creation
 */
@Test
public void testWebPExtension() throws Exception {

	WebPExtension webpExtension = new WebPExtension(geoPackage);

	String tableName = "table";

	Extensions extension = webpExtension.getOrCreate(tableName);
	assertNotNull(extension);
	assertTrue(webpExtension.has(tableName));

	assertEquals(extension.getExtensionName(), WebPExtension.EXTENSION_NAME);
	assertEquals(extension.getAuthor(),
			GeoPackageConstants.EXTENSION_AUTHOR);
	assertEquals(extension.getExtensionNameNoAuthor(), WebPExtension.NAME);
	assertEquals(extension.getTableName(), tableName);
	assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_DATA);
	assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE);
	assertEquals(extension.getDefinition(), WebPExtension.DEFINITION);

	GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName);
	assertFalse(webpExtension.has(tableName));

}
 
Example #4
Source File: GeometryExtensions.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * Get the extension name of a GeoPackage extension Geometry
 * 
 * @param geometryType
 *            geometry type
 * @return extension name
 */
public static String getExtensionName(GeometryType geometryType) {

	if (!isExtension(geometryType)) {
		throw new GeoPackageException(GeometryType.class.getSimpleName()
				+ " is not an extension: " + geometryType.getName());
	}

	if (!isGeoPackageExtension(geometryType)) {
		throw new GeoPackageException(
				GeometryType.class.getSimpleName()
						+ " is not a GeoPackage extension, User-Defined requires an author: "
						+ geometryType.getName());
	}

	String extensionName = GeoPackageConstants.EXTENSION_AUTHOR
			+ Extensions.EXTENSION_NAME_DIVIDER
			+ GeoPackageConstants.GEOMETRY_EXTENSION_PREFIX
			+ Extensions.EXTENSION_NAME_DIVIDER + geometryType.getName();

	return extensionName;
}
 
Example #5
Source File: GeometryExtensions.java    From geopackage-core-java with MIT License 6 votes vote down vote up
/**
 * Get the extension name of a extension Geometry, either user-defined or
 * GeoPackage extension
 * 
 * @param author
 *            author
 * @param geometryType
 *            geometry type
 * @return extension name
 * @deprecated as of 1.2.1, On August 15, 2016 the GeoPackage SWG voted to
 *             remove this extension from the standard due to
 *             interoperability concerns. (GeoPackage version 1.2)
 */
public static String getExtensionName(String author,
		GeometryType geometryType) {

	if (!isExtension(geometryType)) {
		throw new GeoPackageException(GeometryType.class.getSimpleName()
				+ " is not an extension: " + geometryType.getName());
	}

	String extensionName = (isGeoPackageExtension(geometryType) ? GeoPackageConstants.EXTENSION_AUTHOR
			: author)
			+ Extensions.EXTENSION_NAME_DIVIDER
			+ GeoPackageConstants.GEOMETRY_EXTENSION_PREFIX
			+ Extensions.EXTENSION_NAME_DIVIDER + geometryType.getName();

	return extensionName;
}
 
Example #6
Source File: ShareTask.java    From geopackage-mapcache-android with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected String doInBackground(Object... params) {

    File databaseFile = (File) params[0];
    String database = (String) params[1];

    // Copy the database to cache
    File cacheDirectory = getDatabaseCacheDirectory();
    cacheDirectory.mkdir();
    cacheFile = new File(cacheDirectory, database + "."
            + GeoPackageConstants.GEOPACKAGE_EXTENSION);
    try {
        GeoPackageIOUtils.copyFile(databaseFile, cacheFile);
    } catch (IOException e) {
        return e.getMessage();
    }

    return null;
}
 
Example #7
Source File: GeoPackageManagerImpl.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean createAtPath(String database, File path) {

    // Create the absolute file path
    File file = new File(path, database + "." + GeoPackageConstants.EXTENSION);

    // Create the GeoPackage
    boolean created = createFile(database, file);

    return created;
}
 
Example #8
Source File: ZoomOtherExtensionTest.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Test the Zoom Other Extension creation
 */
@Test
public void testZoomOtherExtension() throws Exception {

	ZoomOtherExtension zoomOtherExtension = new ZoomOtherExtension(
			geoPackage);

	String tableName = "table";

	Extensions extension = zoomOtherExtension.getOrCreate(tableName);
	assertNotNull(extension);
	assertTrue(zoomOtherExtension.has(tableName));

	assertEquals(extension.getExtensionName(),
			ZoomOtherExtension.EXTENSION_NAME);
	assertEquals(extension.getAuthor(),
			GeoPackageConstants.EXTENSION_AUTHOR);
	assertEquals(extension.getExtensionNameNoAuthor(),
			ZoomOtherExtension.NAME);
	assertEquals(extension.getTableName(), tableName);
	assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_DATA);
	assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE);
	assertEquals(extension.getDefinition(), ZoomOtherExtension.DEFINITION);

	GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName);
	assertFalse(zoomOtherExtension.has(tableName));

}
 
Example #9
Source File: GeoPackageManager.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Open a GeoPackage
 * 
 * @param name
 *            GeoPackage name
 * @param file
 *            GeoPackage file
 * @param validate
 *            validate the GeoPackage
 * @return GeoPackage
 * @since 3.3.0
 */
public static GeoPackage open(String name, File file, boolean validate) {

	// Validate or add the file extension
	if (validate) {
		if (GeoPackageIOUtils.hasFileExtension(file)) {
			GeoPackageValidate.validateGeoPackageExtension(file);
		} else {
			file = GeoPackageIOUtils.addFileExtension(file,
					GeoPackageConstants.EXTENSION);
		}
	}

	// Create the GeoPackage Connection and table creator
	GeoPackageConnection connection = connect(file);
	GeoPackageTableCreator tableCreator = new GeoPackageTableCreator(
			connection);

	// Create a GeoPackage
	GeoPackage geoPackage = new GeoPackageImpl(name, file, connection,
			tableCreator);

	// Validate the GeoPackage has the minimum required tables
	if (validate) {
		try {
			GeoPackageValidate.validateMinimumTables(geoPackage);
		} catch (RuntimeException e) {
			geoPackage.close();
			throw e;
		}
	}

	return geoPackage;
}
 
Example #10
Source File: GeoPackageManager.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Create a GeoPackage
 * 
 * @param file
 *            file
 * @return true if created
 */
public static boolean create(File file) {

	boolean created = false;

	// Validate or add the file extension
	if (GeoPackageIOUtils.hasFileExtension(file)) {
		GeoPackageValidate.validateGeoPackageExtension(file);
	} else {
		file = GeoPackageIOUtils.addFileExtension(file,
				GeoPackageConstants.EXTENSION);
	}

	if (file.exists()) {
		throw new GeoPackageException(
				"GeoPackage already exists: " + file.getAbsolutePath());
	} else {
		// Create the GeoPackage Connection
		GeoPackageConnection connection = connect(file);

		// Set the GeoPackage application id and user version
		connection.setApplicationId();
		connection.setUserVersion();

		// Create the minimum required tables
		GeoPackageTableCreator tableCreator = new GeoPackageTableCreator(
				connection);
		tableCreator.createRequired();

		connection.close();
		created = true;
	}

	return created;
}
 
Example #11
Source File: GeoPackageGeometryData.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * Write the geometry to bytes
 * 
 * @return bytes
 * @throws IOException
 *             upon failure
 */
public byte[] toBytes() throws IOException {

	ByteWriter writer = new ByteWriter();

	// Write GP as the 2 byte magic number
	writer.writeString(GeoPackageConstants.GEOMETRY_MAGIC_NUMBER);

	// Write a byte as the version, value of 0 = version 1
	writer.writeByte(GeoPackageConstants.GEOMETRY_VERSION_1);

	// Build and write a flags byte
	byte flags = buildFlagsByte();
	writer.writeByte(flags);
	writer.setByteOrder(byteOrder);

	// Write the 4 byte srs id int
	writer.writeInt(srsId);

	// Write the envelope
	writeEnvelope(writer);

	// Save off where the WKB bytes start
	wkbGeometryIndex = writer.size();

	// Write the Well-Known Binary Geometry if not marked as empty
	if (!empty) {
		GeometryWriter.writeGeometry(writer, geometry);
	}

	// Get the bytes
	bytes = writer.getBytes();

	// Close the writer
	writer.close();

	return bytes;
}
 
Example #12
Source File: GeoPackageValidate.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * Validate the extension file name as a GeoPackage
 * 
 * @param name
 *            GeoPackage file name
 * @since 3.5.0
 */
public static void validateGeoPackageExtension(String name) {
	if (!hasGeoPackageExtension(name)) {
		throw new GeoPackageException("GeoPackage database file name '"
				+ name + "' does not have a valid extension of '"
				+ GeoPackageConstants.EXTENSION + "' or '"
				+ GeoPackageConstants.EXTENDED_EXTENSION + "'");
	}
}
 
Example #13
Source File: GeoPackageValidate.java    From geopackage-core-java with MIT License 5 votes vote down vote up
/**
 * Validate the extension file as a GeoPackage
 * 
 * @param file
 *            GeoPackage file
 */
public static void validateGeoPackageExtension(File file) {
	if (!hasGeoPackageExtension(file)) {
		throw new GeoPackageException("GeoPackage database file '" + file
				+ "' does not have a valid extension of '"
				+ GeoPackageConstants.EXTENSION + "' or '"
				+ GeoPackageConstants.EXTENDED_EXTENSION + "'");
	}
}
 
Example #14
Source File: CacheUtils.java    From mage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Copy the Uri to the cache directory in a background task
 *
 * @param context
 * @param uri
 * @param path bn
 */
public static void copyToCache(Context context, Uri uri, String path) {

    // Get a cache directory to write to
    File cacheDirectory = CacheUtils.getApplicationCacheDirectory(context);
    if (cacheDirectory != null) {

        // Get the Uri display name, which should be the file name with extension
        String name = MediaUtility.getDisplayName(context, uri, path);

        // If no extension, add a GeoPackage extension
        if(GeoPackageIOUtils.getFileExtension(new File(name)) == null){
            name += "." + GeoPackageConstants.GEOPACKAGE_EXTENSION;
        }

        // Verify that the file is a cache file by its extension
        File cacheFile = new File(cacheDirectory, name);
        if (isCacheFile(cacheFile)) {

            if(cacheFile.exists()) {
                cacheFile.delete();
            }
            String cacheName = MediaUtility.getFileNameWithoutExtension(cacheFile);
            CacheProvider.getInstance(context).removeCacheOverlay(cacheName);

            // Copy the file in a background task
            CopyCacheStreamTask task = new CopyCacheStreamTask(context, uri, cacheFile, cacheName);
            task.execute();
        }
    }
}
 
Example #15
Source File: ZoomOtherExtensionTest.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Test the Zoom Other Extension creation
 */
@Test
public void testZoomOtherExtension() throws Exception {

    ZoomOtherExtension zoomOtherExtension = new ZoomOtherExtension(
            geoPackage);

    String tableName = "table";

    Extensions extension = zoomOtherExtension.getOrCreate(tableName);
    assertNotNull(extension);
    assertTrue(zoomOtherExtension.has(tableName));

    assertEquals(extension.getExtensionName(),
            ZoomOtherExtension.EXTENSION_NAME);
    assertEquals(extension.getAuthor(),
            GeoPackageConstants.EXTENSION_AUTHOR);
    assertEquals(extension.getExtensionNameNoAuthor(),
            ZoomOtherExtension.NAME);
    assertEquals(extension.getTableName(), tableName);
    assertEquals(extension.getColumnName(), TileTable.COLUMN_TILE_DATA);
    assertEquals(extension.getScope(), ExtensionScopeType.READ_WRITE);
    assertEquals(extension.getDefinition(), ZoomOtherExtension.DEFINITION);

    GeoPackageExtensions.deleteTableExtensions(geoPackage, tableName);
    assertFalse(zoomOtherExtension.has(tableName));

}
 
Example #16
Source File: GeoPackageManagerImpl.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@RequiresApi(api = Build.VERSION_CODES.Q)
@Override
public void exportGeoPackage(String database, String name, String relativePath, Uri uri) throws IOException {

    // Add the extension if not on the name
    name = GeoPackageValidate.addGeoPackageExtension(name);

    ContentValues contentValues = new ContentValues();
    contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, name);
    contentValues.put(MediaStore.MediaColumns.MIME_TYPE, GeoPackageConstants.MEDIA_TYPE);
    contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, relativePath);

    exportGeoPackage(database, uri, contentValues);
}
 
Example #17
Source File: GeoPackageCoreConnection.java    From geopackage-core-java with MIT License 4 votes vote down vote up
/**
 * Set the GeoPackage application id
 */
public void setApplicationId() {
	setApplicationId(GeoPackageConstants.APPLICATION_ID);
}
 
Example #18
Source File: GeoPackageGeometryData.java    From geopackage-core-java with MIT License 4 votes vote down vote up
/**
 * Populate the geometry data from the bytes
 * 
 * @param bytes
 *            geometry bytes
 */
public void fromBytes(byte[] bytes) {
	this.bytes = bytes;

	ByteReader reader = new ByteReader(bytes);

	// Get 2 bytes as the magic number and validate
	String magic = null;
	try {
		magic = reader.readString(2);
	} catch (UnsupportedEncodingException e) {
		throw new GeoPackageException(
				"Unexpected GeoPackage Geometry magic number character encoding: Expected: "
						+ GeoPackageConstants.GEOMETRY_MAGIC_NUMBER);
	}
	if (!magic
			.equals(GeoPackageConstants.GEOMETRY_MAGIC_NUMBER)) {
		throw new GeoPackageException(
				"Unexpected GeoPackage Geometry magic number: "
						+ magic
						+ ", Expected: "
						+ GeoPackageConstants.GEOMETRY_MAGIC_NUMBER);
	}

	// Get a byte as the version and validate, value of 0 = version 1
	byte version = reader.readByte();
	if (version != GeoPackageConstants.GEOMETRY_VERSION_1) {
		throw new GeoPackageException(
				"Unexpected GeoPackage Geometry version: "
						+ version
						+ ", Expected: "
						+ GeoPackageConstants.GEOMETRY_VERSION_1);
	}

	// Get a flags byte and then read the flag values
	byte flags = reader.readByte();
	int envelopeIndicator = readFlags(flags);
	reader.setByteOrder(byteOrder);

	// Read the 5th - 8th bytes as the srs id
	srsId = reader.readInt();

	// Read the envelope
	envelope = readEnvelope(envelopeIndicator, reader);

	// Save off where the WKB bytes start
	wkbGeometryIndex = reader.getNextByte();

	// Read the Well-Known Binary Geometry if not marked as empty
	if (!empty) {
		geometry = GeometryReader.readGeometry(reader);
	}

}
 
Example #19
Source File: TestSetupTeardown.java    From geopackage-android with MIT License 4 votes vote down vote up
/**
 * Set up the create database
 *
 * @param activity
 * @param testContext
 * @param features
 * @param allowEmptyFeatures
 * @param tiles
 * @return
 * @throws SQLException
 * @throws IOException
 * @parma name
 */
public static GeoPackage setUpCreate(Activity activity,
                                     Context testContext, String name, boolean features, boolean allowEmptyFeatures, boolean tiles)
        throws SQLException, IOException {

    GeoPackageManager manager = GeoPackageFactory.getManager(activity);

    // Delete
    manager.delete(name);

    // Create
    manager.create(name);

    // Open
    GeoPackage geoPackage = manager.open(name);
    if (geoPackage == null) {
        throw new GeoPackageException("Failed to open database");
    }

    TestCase.assertEquals("Application Id", geoPackage.getApplicationId(), GeoPackageConstants.APPLICATION_ID);
    TestCase.assertEquals("User Version", geoPackage.getUserVersion(), GeoPackageConstants.USER_VERSION);
    String userVersionString = String.valueOf(geoPackage.getUserVersion());
    String majorVersion = userVersionString.substring(0, userVersionString.length() - 4);
    String minorVersion = userVersionString.substring(userVersionString.length() - 4, userVersionString.length() - 2);
    String patchVersion = userVersionString.substring(userVersionString.length() - 2);
    TestCase.assertEquals("Major User Version", geoPackage.getUserVersionMajor(), Integer.valueOf(majorVersion).intValue());
    TestCase.assertEquals("Minor User Version", geoPackage.getUserVersionMinor(), Integer.valueOf(minorVersion).intValue());
    TestCase.assertEquals("Patch User Version", geoPackage.getUserVersionPatch(), Integer.valueOf(patchVersion).intValue());

    if (features) {
        setUpCreateFeatures(geoPackage, allowEmptyFeatures);
    }

    if (tiles) {
        setUpCreateTiles(testContext, geoPackage);
    }

    setUpCreateCommon(geoPackage);

    return geoPackage;
}
 
Example #20
Source File: TestSetupTeardown.java    From geopackage-java with MIT License 4 votes vote down vote up
/**
 * Set up the create database
 * 
 * @param directory
 * @param name
 * @param features
 * @param allowEmptyFeatures
 * @param tiles
 * @return GeoPackage
 * @throws SQLException
 * @throws IOException
 */
public static GeoPackage setUpCreate(File directory, String name,
		boolean features, boolean allowEmptyFeatures, boolean tiles)
		throws SQLException, IOException {

	File dbFile = new File(directory, name);

	// Create
	assertTrue("Database failed to create",
			GeoPackageManager.create(dbFile));

	// Open
	GeoPackage geoPackage = GeoPackageManager.open(dbFile);
	if (geoPackage == null) {
		throw new GeoPackageException("Failed to open database");
	}

	assertEquals("Application Id", geoPackage.getApplicationId(),
			GeoPackageConstants.APPLICATION_ID);
	assertEquals("User Version", geoPackage.getUserVersion(),
			GeoPackageConstants.USER_VERSION);
	String userVersionString = String.valueOf(geoPackage.getUserVersion());
	String majorVersion = userVersionString.substring(0,
			userVersionString.length() - 4);
	String minorVersion = userVersionString.substring(
			userVersionString.length() - 4, userVersionString.length() - 2);
	String patchVersion = userVersionString
			.substring(userVersionString.length() - 2);
	assertEquals("Major User Version", geoPackage.getUserVersionMajor(),
			Integer.valueOf(majorVersion).intValue());
	assertEquals("Minor User Version", geoPackage.getUserVersionMinor(),
			Integer.valueOf(minorVersion).intValue());
	assertEquals("Patch User Version", geoPackage.getUserVersionPatch(),
			Integer.valueOf(patchVersion).intValue());

	if (features) {
		setUpCreateFeatures(geoPackage, allowEmptyFeatures);
	}

	if (tiles) {
		setUpCreateTiles(geoPackage);
	}

	setUpCreateCommon(geoPackage);

	return geoPackage;
}
 
Example #21
Source File: TestSetupTeardown.java    From geopackage-android-map with MIT License 4 votes vote down vote up
/**
 * Set up the create database
 * 
 * @param activity
 * @param testContext
 * @param features
 * @param allowEmptyFeatures
 * @param tiles
 * @return
 * @throws SQLException
 * @throws IOException
 */
public static GeoPackage setUpCreate(Activity activity,
		Context testContext, boolean features, boolean allowEmptyFeatures, boolean tiles)
		throws SQLException, IOException {

	GeoPackageManager manager = GeoPackageFactory.getManager(activity);

	// Delete
	manager.delete(TestConstants.TEST_DB_NAME);

	// Create
	manager.create(TestConstants.TEST_DB_NAME);

	// Open
	GeoPackage geoPackage = manager.open(TestConstants.TEST_DB_NAME);
	if (geoPackage == null) {
		throw new GeoPackageException("Failed to open database");
	}

	TestCase.assertEquals("Application Id", geoPackage.getApplicationId(), GeoPackageConstants.APPLICATION_ID);
	TestCase.assertEquals("User Version", geoPackage.getUserVersion(), GeoPackageConstants.USER_VERSION);
	String userVersionString = String.valueOf(geoPackage.getUserVersion());
	String majorVersion = userVersionString.substring(0, userVersionString.length() - 4);
	String minorVersion = userVersionString.substring(userVersionString.length() - 4, userVersionString.length() - 2);
	String patchVersion = userVersionString.substring(userVersionString.length() - 2);
	TestCase.assertEquals("Major User Version", geoPackage.getUserVersionMajor(), Integer.valueOf(majorVersion).intValue());
	TestCase.assertEquals("Minor User Version", geoPackage.getUserVersionMinor(), Integer.valueOf(minorVersion).intValue());
	TestCase.assertEquals("Patch User Version", geoPackage.getUserVersionPatch(), Integer.valueOf(patchVersion).intValue());

	if (features) {
		setUpCreateFeatures(geoPackage, allowEmptyFeatures);
	}

	if (tiles) {
		setUpCreateTiles(testContext, geoPackage);
	}

	setUpCreateCommon(geoPackage);

	return geoPackage;
}
 
Example #22
Source File: GeoPackageValidate.java    From geopackage-core-java with MIT License 3 votes vote down vote up
/**
 * Add a GeoPackage extension if one does not exist
 * 
 * @param name
 *            GeoPackage file name
 * @return GeoPackage name with extension
 * @since 3.5.0
 */
public static String addGeoPackageExtension(String name) {
	if (!hasGeoPackageExtension(name)) {
		name += "." + GeoPackageConstants.EXTENSION;
	}
	return name;
}
 
Example #23
Source File: GeoPackageValidate.java    From geopackage-core-java with MIT License 3 votes vote down vote up
/**
 * Check if a GeoPackage extension
 * 
 * @param extension
 *            file extension
 * @return true if GeoPackage extension
 * @since 3.5.0
 */
public static boolean isGeoPackageExtension(String extension) {
	return extension != null && (extension
			.equalsIgnoreCase(GeoPackageConstants.EXTENSION)
			|| extension.equalsIgnoreCase(
					GeoPackageConstants.EXTENDED_EXTENSION));
}
 
Example #24
Source File: GeoPackageCoreConnection.java    From geopackage-core-java with MIT License 2 votes vote down vote up
/**
 * Set the GeoPackage user version
 * 
 * @since 1.2.1
 */
public void setUserVersion() {
	setUserVersion(GeoPackageConstants.USER_VERSION);
}