mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-16 05:24:26 +02:00
Import find_spatialite into utils for backwards compat
This commit is contained in:
parent
06f1270edd
commit
a3639f39d9
2 changed files with 6 additions and 4 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import os
|
||||||
from .db import Database, Table
|
|
||||||
|
|
||||||
SPATIALITE_PATHS = (
|
SPATIALITE_PATHS = (
|
||||||
"/usr/lib/x86_64-linux-gnu/mod_spatialite.so",
|
"/usr/lib/x86_64-linux-gnu/mod_spatialite.so",
|
||||||
|
|
@ -30,7 +29,7 @@ def find_spatialite() -> str:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def init_spatialite(db: Database, path: str) -> bool:
|
def init_spatialite(db, path: str) -> bool:
|
||||||
"""
|
"""
|
||||||
The ``init_spatialite`` function will load and initialize the Spatialite extension.
|
The ``init_spatialite`` function will load and initialize the Spatialite extension.
|
||||||
The ``path`` argument should be an absolute path to the compiled extension, which
|
The ``path`` argument should be an absolute path to the compiled extension, which
|
||||||
|
|
@ -67,7 +66,7 @@ def init_spatialite(db: Database, path: str) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def add_geometry_column(
|
def add_geometry_column(
|
||||||
table: Table,
|
table,
|
||||||
geometry_type: str,
|
geometry_type: str,
|
||||||
column_name: str = "geometry",
|
column_name: str = "geometry",
|
||||||
srid: int = 4326,
|
srid: int = 4326,
|
||||||
|
|
@ -106,7 +105,7 @@ def add_geometry_column(
|
||||||
return result and bool(result[0])
|
return result and bool(result[0])
|
||||||
|
|
||||||
|
|
||||||
def create_spatial_index(table: Table, column_name: str = "geometry") -> bool:
|
def create_spatial_index(table, column_name: str = "geometry") -> bool:
|
||||||
"""
|
"""
|
||||||
A spatial index allows for significantly faster bounding box queries.
|
A spatial index allows for significantly faster bounding box queries.
|
||||||
To create on, use ``create_spatial_index`` with a :ref:`table <reference_db_table>`
|
To create on, use ``create_spatial_index`` with a :ref:`table <reference_db_table>`
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ except ImportError:
|
||||||
|
|
||||||
OperationalError = sqlite3.OperationalError
|
OperationalError = sqlite3.OperationalError
|
||||||
|
|
||||||
|
# backwards compatibility
|
||||||
|
from .gis import find_spatialite
|
||||||
|
|
||||||
|
|
||||||
def suggest_column_types(records):
|
def suggest_column_types(records):
|
||||||
all_column_types = {}
|
all_column_types = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue