Skip to content

Ryandev/spatialite-iOS

Repository files navigation

Spatialite

Build Status Carthage Compatible License

Spatialite is a plugin for SQLite that allows for geo-spatial queries

Usage

  • Include spatialite and sqlite header
#import <spatialite/spatialite.h>
#import <sqlite3/sqlite3.h>
  • Initialize spatialite where ''mySQLite3Connection'' is your handle to a valid database instance
int sqliteInitStatus = sqlite3_initialize();
assert(sqliteInitStatus==SQLITE_OK);
        
int sqliteInitOSStatus = sqlite3_os_init();
assert(sqliteInitOSStatus==SQLITE_OK);
        
sqlite3_enable_load_extension(mySQLite3Connection, 1);
        
spatialite_initialize();

_spatialiteConn = spatialite_alloc_connection();
assert(_spatialiteConn);
spatialite_init_ex(mySQLite3Connection, _spatialiteConn, 1);```

After the above you can call SQLite with queries containing spatialite functions

Notes

If you use the sqlite3 built provided by iOS/Mac ensure this version supports loading extension (Alternatively build sqlite3 with extension support)

Project setup

Carthage

github 'Ryandev/proj4' == 4.9.2
github 'Ryandev/geos' == 3.5.0

License

SpatiaLite is licensed under the MPL tri-license terms; you are free to choose the best-fit license between:

  1. MPL 1.1
  2. GPL v2.0 or any subsequent version
  3. LGPL v2.1 or any subsequent version

About

Spatialite built for iOS using Carthage

Resources

Stars

Watchers

Forks

Packages

No packages published