摘要
创建 SQLite 数据库或 GeoPackage。
语法
CreateSQLiteDatabase (sqlite_database_path, {spatial_type})
参数 | 说明 | 数据类型 |
sqlite_database_path | Location of the SQLite database to be created and the name of the SQLite database file. You must include the .sqlite extension in the database file name if creating a SQLite database that uses a spatial type of ST_Geometry or SpatiaLite. When creating a GeoPackage, a .gpkg extension is required. | String |
spatial_type | The geometry type to install with the new SQLite database. You can use only one geometry type in SQLite databases.
| String |
返回值
数据类型 | 说明 |
File | 安装 ST_Geometry 或 SpatiaLite 几何类型的 SQLite 数据库(扩展名为 .sqlite)。此外,将返回 GeoPackage(.gpkg 扩展名)。 |
代码示例
CreateSQLiteDatabase ST_Geometry 示例 1
创建 SQLite 数据库。
import arcpy
# Set local variables
sqlite_database_path = 'C:/Data/Counties.sqlite'
# Execute CreateSQLiteDatabase
arcpy.gp.CreateSQLiteDatabase(sqlite_database_path, "ST_GEOMETRY")
CreateSQLiteDatabase GeoPackage 示例 2
创建 GeoPackage。
import arcpy
# Set local variables
sqlite_database_path = 'C:/Data/Counties.gpkg'
# Execute CreateSQLiteDatabase
arcpy.gp.CreateSQLiteDatabase(sqlite_database_path, "GEOPACKAGE")