Skip to main content
3 of 5
removed thanks
Vince
  • 20.3k
  • 16
  • 48
  • 65

Best approach for indexing a SQLite database containing geoJSON spatial objects?

I'm building an iOS application for public release. My architecture currently includes Mapbox, Parse, geoJSON and SQLite for the local store. The app will store spatial objects locally as a string in a SQLite database, and when a user opens the map view the app will query for spatial objects that exist within the map extent. Parsing/querying the raw geoJSON data would be very costly so I want to index the tables that contain any spatial data.

What's the best approach for this? Is it efficient enough to store the spatial object's bounding box (or envelope) in a separate column and index that column? Or should I go a step further and split out the envelop into it's component xmin, xmax, ymin, and ymax values, store those in their own columns and index each of those columns?

Or perhaps there's another approach I haven't considered yet? Maybe I shouldn't be storing the geoJSON at all and only the geometries? I haven't fully committed to any design decisions yet, so I was hoping to hear thoughts from other's with more experience before I start building out the db.