I am at present 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 must create an r-tree index desk to permit customers to cross a bounding field and retrieve all the persevered parts 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 the way to get this r-tree index desk up and operating. What would the database schema seem like and the way would I even get a bounding field if all I’ve is a mannequin with a particular location? I might recognize some ideas!