-
-
Notifications
You must be signed in to change notification settings - Fork 117
Helper methods for working with SpatiaLite #79
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
Comments
Came here to add this. I might pick it up. Would also add a utility to create (and update and delete?) a spatial index. It's not much code but I have to look it up every time. |
Some proposals I'd add to sqlite-utils: Some version of this, from geojson-to-sqlite: 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)") Also a function for creating a spatial index: db.conn.execute("select CreateSpatialIndex(?, ?)", [table, "geometry"]) I don't know the nuances of updating a spatial index, or checking if one already exists. This could be a CLI method like: sqlite-utils spatial-index spatial.db table-name column-name |
Other thing: If there get to be enough utils, I think it's worth moving all the spatialite stuff into its own file ( |
One more thing I'm going to add: A method to add a geometry column, which I'll need to do to create a spatial index on a table. |
Taking part of the conversation from #385 here.
Yes. And also |
As demonstrated by this piece of documentation, using SpatiaLite with sqlite-utils requires a fair bit of boilerplate:
sqlite-utils/docs/python-api.rst
Lines 880 to 909 in f728917
The text was updated successfully, but these errors were encountered: