All Projects → sevar83 → android-spatialite

sevar83 / android-spatialite

Licence: other
Spatialite database JNI wrapper for Android

Programming Languages

c
50402 projects - #5 most used programming language
HTML
75241 projects
Makefile
30231 projects
shell
77523 projects
C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to android-spatialite

is-osm-uptodate
Find outdated nodes in OpenStreetMap
Stars: ✭ 16 (-81.82%)
Mutual labels:  spatialite
GeoParser
Extract and Visualize location from any file
Stars: ✭ 48 (-45.45%)
Mutual labels:  geospatial-data
open-geo-data-education
Open Geospatial Datasets for GIS Education: This is a repository of open geospatial datasets to be used in an educational context. I created these files over years of teaching Geographic Data Science and GIS. All original datasets are freely available online with open data licenses (see the dataset attribution for details). All the datasets in t…
Stars: ✭ 52 (-40.91%)
Mutual labels:  geospatial-data
geospatial-python
Introduction to Geospatial Raster and Vector Data with Python
Stars: ✭ 107 (+21.59%)
Mutual labels:  geospatial-data
geospatial-learn
A python library for geo-spatial processing and machine learning
Stars: ✭ 20 (-77.27%)
Mutual labels:  geospatial-data
terrame
TerraME is a programming environment for spatial dynamical modelling
Stars: ✭ 33 (-62.5%)
Mutual labels:  geospatial-data
pentaho-gis-plugins
🗺 GIS plugins for Pentaho Data Integration
Stars: ✭ 42 (-52.27%)
Mutual labels:  spatialite
Felicette
Satellite imagery for dummies.
Stars: ✭ 1,710 (+1843.18%)
Mutual labels:  geospatial-data
awesome-geospatial-data-download-sites
This is the repo for open source geospatial data download sites.
Stars: ✭ 19 (-78.41%)
Mutual labels:  geospatial-data
transbigdata
A Python package develop for transportation spatio-temporal big data processing, analysis and visualization.
Stars: ✭ 195 (+121.59%)
Mutual labels:  geospatial-data
awesome-geospatial-list
A curated list of geospatial tools, data, tutorials, information, and more
Stars: ✭ 32 (-63.64%)
Mutual labels:  geospatial-data
Land-Cover-Classification-using-Sentinel-2-Dataset
Application of deep learning on Satellite Imagery of Sentinel-2 satellite that move around the earth from June, 2015. This image patches can be trained and classified using transfer learning techniques.
Stars: ✭ 36 (-59.09%)
Mutual labels:  geospatial-data
community-sprints
This repo is used to organize and collaborate in sprints for code projects, hackathons, STAC and metadata specs development
Stars: ✭ 18 (-79.55%)
Mutual labels:  geospatial-data
census-map-consolidator
Combine Census blocks into new shapes
Stars: ✭ 31 (-64.77%)
Mutual labels:  geospatial-data
kart
Distributed version-control for geospatial and tabular data
Stars: ✭ 253 (+187.5%)
Mutual labels:  geospatial-data
DsgTools
DSG's QGIS Plugin for GIS production
Stars: ✭ 37 (-57.95%)
Mutual labels:  spatialite
python-aos-lesson
Python for Atmosphere and Ocean Scientists
Stars: ✭ 78 (-11.36%)
Mutual labels:  geospatial-data
Gdal
GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats.
Stars: ✭ 2,797 (+3078.41%)
Mutual labels:  geospatial-data
magicbox-kepler-app
Visualizing MagicBox data on country maps using KeplerGL
Stars: ✭ 21 (-76.14%)
Mutual labels:  geospatial-data
fdotoolbox
A tool for working with various sources of geospatial data
Stars: ✭ 20 (-77.27%)
Mutual labels:  geospatial-data

Release

android-spatialite

WHAT IS THIS?

  • The Spatialite database ported for Android
  • 100% offline, portable and self-contained as SQLite.

WHEN DO I NEED IT?

  • When you need deployment, collecting, processing and fast querying of small to huge amounts of geometry data (points, polylines, polygons, multipolygons, etc.) on Android devices.
  • When you want to be 100% independent from any server/cloud backend.

GETTING STARTED

If you know basic SQLite, there's almost nothing to learn. The API is 99% the same as the Android SQLite API (as of API level 15). The main difference is the packaging. Use org.spatialite.database.XYZ instead of android.database.sqlite.XYZ and org.spatialite.XYZ instead of android.database.XYZ. Same applies to the other classes - all platform SQLiteXYZ classes have their Spatialite versions.

Gradle

  1. Have this in your project's build.gradle:
allprojects {
  repositories {
    ...
    maven { url "https://jitpack.io" }
  }
}
  1. Add the following to your module's build.gradle:
implementation 'com.github.sevar83:android-spatialite:<LATEST_VERSION>'

EXAMPLE CODE

There is a very simple and useless example in the app module. Another example is the SpatiAtlas experiment.

HOW IT WORKS?

Works the same way as the platform SQLite. It's accessible through Java/JNI wrappers around the Spatialite C library. The Spatialite wrappers were derived and adapted from the platform SQLite wrappers (the standard Android SQLite API).

Other FAQ

What is Spatialite?

Simply: Spatialite = SQLite + advanced geospatial support.
Spatialite is a geospatial extension to SQLite. It is a set of few libraries written in C to extend SQLite with geometry data types and many SQL functions above geometry data. For more info: https://www.gaia-gis.it/gaia-sins/

Is there a list of all supported Spatialite functions?

Yes - http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.4.0.html

Does it use JDBC?

No. It uses cursors - the suggested lightweight approach to access SQL used in the Android platform instead of the heavier JDBC.

64-bit architectures supported?

Yes. It builds for arm64-v8a and x86_64. mips64 is not tested.

Reducing the APK size.

This library is distributed as multi-architecture AAR file. By default Gradle will produce a universal APK including the native .so libraries compiled for all supported CPU architectures. Usually that's unacceptable for large libraries like this. But that's easily fixed by using Gradle's "ABI splits" feature. The following gradle code will produce a separate APK per each architecture. The APK size is reduced few times.

android {
    splits {
        abi {
            enable true
                reset()
                include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
            }
        }
    }
}

What libraries are packaged currently?

  • SQLite 3.15.1
  • Spatialite 4.3.0a
  • GEOS 3.4.2
  • Proj4 4.8.0
  • lzma 5.2.1
  • iconv 1.13
  • xml2 2.9.2
  • freexl 1.0.2

REQUIREMENTS

Min SDK 16

MIGRATION TO 2.0+

  1. Remove calls to SQLiteDatabase.loadLibs(). Now it is automatically done.
  2. Replace all occasions of import org.spatialite.Cursor; with import android.database.Cursor;
  3. Replace all occasions of import org.spatialite.database.SQLite***Exception; with import android.database.sqlite.SQLite***Exception;

CHANGES

2.0.1

  • Migrated to AndroidX
  • Fixed native crash #4

2.0.0

  • Now using the Requery.io SQLite wrapper instead of SQLCipher's. This results to:
  • Android Nougat (25+) supported. The native code no more links to private NDK libraries exception and warning messages similar to UnsatisfiedLinkError: dlopen failed: library "libandroid_runtime.so" not found should be no more. For more details: https://developer.android.com/about/versions/nougat/android-7.0-changes.html#ndk;
  • Much cleaner codebase derived from a much newer and more mature AOSP SQLite wrapper snapshot;
  • Now possible to build with the latest NDK (tested on R14);
  • Switched to CLang as the default NDK toolchain;
  • 64-bit build targets (arm64-v8a, x86_64);
  • SQLiteDatabase.loadLibs() initialization call is not required anymore;
  • Removed org.spatialite.Cursor interface. Used 'android.database.sqlite.Cursor' instead.
  • Removed the SQLiteXyzException classes. Their AOSP originals are used instead;
  • Dropped support for Android localized collation. SQL statements with "COLLATE LOCALIZED" will cause error. This is necessary to reduce the library size and ensure N compatibility;
  • Updated SQLite to 3.15.1;
  • Updated lzma to 5.2.1;
  • Updated FreeXL to 1.0.2;

CREDITS

The main ideas used here were borrowed from:

SUPPORT

If you like this library, please consider...

Buy Me A Coffee

KNOWN PROJECTS USING THIS LIBRARY

LICENSE

Apache License 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].