def test_create_spatial_index(): db = Database(memory=True) spatialite = find_spatialite() assert db.init_spatialite(spatialite) # create a table, add a geometry column with default values table = db.create_table("locations", {"id": str, "properties": str}) assert table.add_geometry_column("geometry", "Point") # index it assert table.create_spatial_index("geometry") assert "idx_locations_geometry" in db.table_names()
def test_add_geometry_column(): db = Database(memory=True) spatialite = find_spatialite() db.init_spatialite(spatialite) # create a table first table = db.create_table("locations", {"id": str, "properties": str}) table.add_geometry_column( column_name="geometry", geometry_type="Point", srid=4326, coord_dimension=2, ) assert db["geometry_columns"].get(["locations", "geometry"]) == { "f_table_name": "locations", "f_geometry_column": "geometry", "geometry_type": 1, # point "coord_dimension": 2, "srid": 4326, "spatial_index_enabled": 0, }