Skip to content

ramsestom/cn1-spatialite

 
 

Repository files navigation

Codename One Spatialite Library

This library adds support for spatial SQLite queries in Codename One apps. It provides a SpatialDB class which extends the built-in Codename One Database class and provides access to spatial queries via the SpatiaLite SQLite plugin.

NOTE: This library depends on features of Codename One which won't be available until May 8, 2018.

License

This library is subject to the license of SpatiaLite, which is licensed under the MPL tri-license. More on their license here

Supported platforms

  • Simulator/Desktop (JavaSE)
  • iOS
  • Android

Installation

Copy the CN1Spatialite.cn1lib into the "lib" directory of your Codename One project, and select "Codename One" > "Refresh Cn1libs" in your project's context menu from the project explorer. Alternatively you can install it directly through Codename One Settings > Extensions.

NOTE: If your project was created before June 2018, you will likely need to make the following modification to your build.xml file in order for your project to build correctly with the CN1Spatialite module. The -post-jar target should look like this:

    <target name="-post-jar">
        <mkdir dir="native/javase" />
        <mkdir dir="native/internal_tmp" />
        <mkdir dir="lib/impl/native/javase" />
        <javac destdir="native/internal_tmp"
            encoding="${source.encoding}"
            source="1.8"
            target="1.8"
            classpath="${run.classpath}:${build.classes.dir}">
            <src path="native/javase"/>
            <src path="lib/impl/native/javase"/>
        </javac>
        <copy todir="native/internal_tmp">
            <fileset dir="native/javase" excludes="*.java,*.jar"/>
            <fileset dir="lib/impl/native/javase" excludes="*.java,*.jar"/>
        </copy>        
    </target> 

The important changes here are that:

  1. The <javac> call should not include a bootclasspath attribute.
  2. The classpath attribute should include ${run.classpath} and not ${javac.classpath}.

Build Hints

On android, this library requires version 25 or higher of the v4 support library. At time of writing (May 2018), the default version on the Codename One build server is 23, so you'll need to add one of the following build hints:

  1. android.supportv4Dep= compile 'com.android.support:support-v4:25.+
  2. android.buildToolsVersion=27.0.3

(You don't need both. Just one).

Usage

See demo

Credits

About

SpatiaLite support for Codename One

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 53.9%
  • C 43.9%
  • Java 1.7%
  • Ruby 0.3%
  • Objective-C 0.2%
  • JavaScript 0.0%