ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Spatially enable an SQLite database

  • Add ST_Geometry tables
  • Add GeoPackage tables

You can either install SpatiaLite, add the ST_Geometry type, or create a GeoPackage to store spatial data in an existing SQLite database.

See SpatiaLite documentation for information on adding SpatiaLite to an SQLite database.

Use SQL to load the ST_Geometry library and either create the ST_Geometry type or a GeoPackage in an existing SQLite database, as described in the following sections.

Add ST_Geometry tables

To add ST_Geometry system tables to an existing SQLite database requires the following:

  • The database file must have the extension .sqlite; therefore, if the database you want to use has a different extension, rename it. For example, if the database is named projdata.d1, rename it to projdata.sqlite before adding the ST_Geometry type to it.
  • The database cannot already contain another spatial type.
  1. If necessary, rename the database file to have the extension .sqlite.
  2. Connect to the database using an SQL editor, such as sqlite3.exe.
  3. Load the ST_Geometry library.

    This example loads the ST_Geometry library to an SQLite database on a Windows computer:

    SELECT load_extension('stgeometry_sqlite.dll','SDE_SQL_funcs_init');
    

    This example loads the ST_Geometry library to an SQLite database on a Linux computer:

    SELECT load_extension('libstgeometry_sqlite.so','SDE_SQL_funcs_init');
    

  4. Call the CreateOGCTables function to add ST_Geometry tables to the database.

    SELECT CreateOGCTables();
    

Add GeoPackage tables

To add GeoPackage system tables to an existing SQLite database requires the following:

  • The database file must have the extension .gpkg; therefore, if the database you want to use has a different extension, rename it. For example, if the database is named study.db, rename it to study.gpkg before adding GeoPackage tables to it.
  • The database cannot already contain another spatial type.
  1. If necessary, rename the database file to have the extension .gpkg.
  2. Connect to the database using an SQL editor, such as sqlite3.exe.
  3. Load the ST_Geometry library.

    This example loads the ST_Geometry library to an SQLite database on a Windows computer:

    SELECT load_extension('stgeometry_sqlite.dll','SDE_SQL_funcs_init');
    

    This example loads the ST_Geometry library to an SQLite database on a Linux computer:

    SELECT load_extension('libstgeometry_sqlite.so','SDE_SQL_funcs_init');
    

  4. Call the CreateGpkgTables function to add GeoPackage tables to the database.

    SELECT CreateGpkgTables();
    

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2019 Esri. | Privacy | Legal