My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

Spatialite for Android

Sqlite extension for the Android platform.

Getting started

NOTE: Currently, only builds using Linux (Ubuntu). To build on Mac OSX or Cygwin see Issue5.

Start by cloning the git repository

git clone https://code.google.com/p/spatialite-android/ 

In the JNI directory download, unpack, and configure GEOS and PROJ.4

$ cd spatialite-android/spatialite-android/jni/
$ wget http://download.osgeo.org/geos/geos-3.2.2.tar.bz2
$ tar xvjf geos-3.2.2.tar.bz2
$ cd geos-3.2.2
$ ./configure --build=x86_64-pc-linux-gnu --host=arm-linux-eabi
$ cd ..
$ wget ftp://ftp.remotesensing.org/proj/proj-4.7.0.tar.gz
$ tar xvzf proj-4.7.0.tar.gz
$ cd proj-4.7.0
$ ./configure --build=x86_64-pc-linux-gnu --host=arm-linux-eabi
$ cd ..

Build the native library

$ /usr/local/android-ndk-r7b/ndk-build

Run the app on emulator or device. First, copy the database to the desired location. Then navigate to "run tests". When the "Press to Start" button is pressed the following should appear in the log

05-25 09:49:38.863: VERBOSE/com.spatialite.TestActivity(5869): Columns: [Distance(PointFromText('point(-77.35368 39.04106)', 4326), PointFromText('point(-77.35581 39.01725)', 4326))]
05-25 09:49:38.873: VERBOSE/com.spatialite.TestActivity(5869): Row: [0.0239050831414628]
05-25 09:49:38.873: VERBOSE/com.spatialite.TestActivity(5869): Columns: [Name, Peoples, AsText(Geometry), GeometryType(Geometry), NumPoints(Geometry), SRID(Geometry), IsValid(Geometry)]
05-25 09:49:38.873: VERBOSE/com.spatialite.TestActivity(5869): Row: [Genova, 610307, POINT(492370.69 4918665.57), POINT, null, 32632, 1]
05-25 09:49:39.033: VERBOSE/com.spatialite.TestActivity(5869): Row: [Roma, 2546804, POINT(788703.57 4645636.3), POINT, null, 32632, 1]
05-25 09:49:39.033: VERBOSE/com.spatialite.TestActivity(5869): Row: [Palermo, 686722, POINT(880179.17 4227024.08), POINT, null, 32632, 1]
05-25 09:49:39.033: VERBOSE/com.spatialite.TestActivity(5869): Row: [Firenze, 356118, POINT(681514.97 4848768.02), POINT, null, 32632, 1]
05-25 09:49:39.033: VERBOSE/com.spatialite.TestActivity(5869): Row: [Milano, 1256211, POINT(514820.49 5034534.56), POINT, null, 32632, 1]
05-25 09:49:39.033: VERBOSE/com.spatialite.TestActivity(5869): Row: [Torino, 865263, POINT(395553.63 4991768.9), POINT, null, 32632, 1]
05-25 09:49:39.043: VERBOSE/com.spatialite.TestActivity(5869): Row: [Napoli, 1004500, POINT(942636.1 4535272.55), POINT, null, 32632, 1]
05-25 09:49:39.043: VERBOSE/com.spatialite.TestActivity(5869): Row: [Bologna, 371217, POINT(686263.23 4929405.15), POINT, null, 32632, 1]
05-25 09:49:39.053: VERBOSE/com.spatialite.TestActivity(5869): Columns: [Distance( Transform(MakePoint(4.430174797, 51.01047063, 4326), 32631), Transform(MakePoint(4.43001276, 51.01041585, 4326),32631))]
05-25 09:49:39.053: VERBOSE/com.spatialite.TestActivity(5869): Row: [12.8984912853814]

Special Thanks

Thank you to everyone who contributed to the following thread:
http://stackoverflow.com/questions/5145388/android-ndk-build-of-spatialite/

and

Mark Renouf
https://github.com/mrenouf/android-spatialite

and

mateuszzz88 for R-Tree test cases

Powered by Google Project Hosting