mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-11 02:54:23 +02:00
Tweaked SpatiaLite CLI docs, refs #398
This commit is contained in:
parent
a692c56659
commit
3e5a4f60cc
2 changed files with 13 additions and 1 deletions
|
|
@ -56,6 +56,8 @@ This page lists the ``--help`` for every ``sqlite-utils`` CLI sub-command.
|
||||||
"insert-files": "cli_insert_files",
|
"insert-files": "cli_insert_files",
|
||||||
"analyze-tables": "cli_analyze_tables",
|
"analyze-tables": "cli_analyze_tables",
|
||||||
"convert": "cli_convert",
|
"convert": "cli_convert",
|
||||||
|
"add-geometry-column": "cli_spatialite",
|
||||||
|
"create-spatial-index": "cli_spatialite_indexes",
|
||||||
}
|
}
|
||||||
commands.sort(key = lambda command: go_first.index(command) if command in go_first else 999)
|
commands.sort(key = lambda command: go_first.index(command) if command in go_first else 999)
|
||||||
cog.out("\n")
|
cog.out("\n")
|
||||||
|
|
@ -1231,6 +1233,8 @@ See :ref:`cli_drop_view`.
|
||||||
add-geometry-column
|
add-geometry-column
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
See :ref:`cli_spatialite`.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
Usage: sqlite-utils add-geometry-column [OPTIONS] DB_PATH TABLE COLUMN_NAME
|
Usage: sqlite-utils add-geometry-column [OPTIONS] DB_PATH TABLE COLUMN_NAME
|
||||||
|
|
@ -1258,6 +1262,8 @@ add-geometry-column
|
||||||
create-spatial-index
|
create-spatial-index
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
See :ref:`cli_spatialite_indexes`.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
Usage: sqlite-utils create-spatial-index [OPTIONS] DB_PATH TABLE COLUMN_NAME
|
Usage: sqlite-utils create-spatial-index [OPTIONS] DB_PATH TABLE COLUMN_NAME
|
||||||
|
|
|
||||||
|
|
@ -1984,13 +1984,14 @@ Since `SpatiaLite <https://www.gaia-gis.it/fossil/libspatialite/index>`__ is com
|
||||||
$ sqlite-utils memory "select spatialite_version()" --load-extension=spatialite
|
$ sqlite-utils memory "select spatialite_version()" --load-extension=spatialite
|
||||||
[{"spatialite_version()": "4.3.0a"}]
|
[{"spatialite_version()": "4.3.0a"}]
|
||||||
|
|
||||||
|
.. _cli_spatialite:
|
||||||
|
|
||||||
SpatiaLite helpers
|
SpatiaLite helpers
|
||||||
==================
|
==================
|
||||||
|
|
||||||
`SpatiaLite <https://www.gaia-gis.it/fossil/libspatialite/home>`_ adds geographic capability to SQLite (similar to how PostGIS builds on PostgreSQL). The `SpatiaLite cookbook <http://www.gaia-gis.it/gaia-sins/spatialite-cookbook-5/index.html>`_ is a good resource for learning what's possible with it.
|
`SpatiaLite <https://www.gaia-gis.it/fossil/libspatialite/home>`_ adds geographic capability to SQLite (similar to how PostGIS builds on PostgreSQL). The `SpatiaLite cookbook <http://www.gaia-gis.it/gaia-sins/spatialite-cookbook-5/index.html>`_ is a good resource for learning what's possible with it.
|
||||||
|
|
||||||
You can convert an existing table to a geographic table by adding a geometry column, use the `sqlite-utils add-geometry-column` command::
|
You can convert an existing table to a geographic table by adding a geometry column, use the ``sqlite-utils add-geometry-column`` command::
|
||||||
|
|
||||||
$ sqlite-utils add-geometry-column spatial.db locations geometry --type POLYGON --srid 4326
|
$ sqlite-utils add-geometry-column spatial.db locations geometry --type POLYGON --srid 4326
|
||||||
|
|
||||||
|
|
@ -2009,6 +2010,11 @@ Eight (case-insensitive) types are allowed:
|
||||||
* GEOMETRYCOLLECTION
|
* GEOMETRYCOLLECTION
|
||||||
* GEOMETRY
|
* GEOMETRY
|
||||||
|
|
||||||
|
.. _cli_spatialite_indexes:
|
||||||
|
|
||||||
|
Adding spatial indexes
|
||||||
|
----------------------
|
||||||
|
|
||||||
Once you have a geometry column, you can speed up bounding box queries by adding a spatial index::
|
Once you have a geometry column, you can speed up bounding box queries by adding a spatial index::
|
||||||
|
|
||||||
$ sqlite-utils create-spatial-index spatial.db locations geometry
|
$ sqlite-utils create-spatial-index spatial.db locations geometry
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue