I am at the moment engaged on establishing a SQLite database utilizing GRDB to retailer a quite simple location-based mannequin (I’ve simplified the mannequin for the aim of this query)
struct ExampleModel: Codable, Identifiable, FetchableRecord, PersistableRecord {
let id: String
let longitude: Double
let latitude: Double
}
Nonetheless, I additionally have to create an r-tree index desk to permit customers to move a bounding field and retrieve all the endured components inside this bounding field
struct BoundingBox {
let minX: Double
let maxX: Double
let minY: Double
let maxY: Double
}
It is the primary time I am having to implement a performance like this and I am completely misplaced on get this r-tree index desk up and working. What would the database schema appear to be and the way would I even get a bounding field if all I’ve is a mannequin with a particular location? I would admire some suggestions!