-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--load-extension=spatialite shortcut option #136
Comments
I think this should initialize SpatiaLite against the current database if it has not been initialized already. Relevant code: https://github.com/simonw/shapefile-to-sqlite/blob/e754d0747ca2facf9a7433e2d5d15a6a37a9cf6e/shapefile_to_sqlite/utils.py#L112-L126 def init_spatialite(db, lib):
db.conn.enable_load_extension(True)
db.conn.load_extension(lib)
# Initialize SpatiaLite if not yet initialized
if "spatial_ref_sys" in db.table_names():
return
db.conn.execute("select InitSpatialMetadata(1)")
def ensure_table_has_geometry(db, table, table_srid):
if "geometry" not in db[table].columns_dict:
db.conn.execute(
"SELECT AddGeometryColumn(?, 'geometry', ?, 'GEOMETRY', 2);",
[table, table_srid],
) Not sure if I should add a utility function or CLI command for that |
The |
To keep the code cleaner, I'm tempted to support this instead:
Where Users could still load a module in a file called
In fact, |
In conjunction with #135 - this would do the same thing as
--load-extension=path-to-spatialite
(see #134)The text was updated successfully, but these errors were encountered: