Tweaked SpatiaLite CLI docs, refs #398

This commit is contained in:
Simon Willison 2022-02-15 17:06:49 -08:00
commit 3e5a4f60cc
2 changed files with 13 additions and 1 deletions

View file

@ -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
[{"spatialite_version()": "4.3.0a"}]
.. _cli_spatialite:
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.
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
@ -2009,6 +2010,11 @@ Eight (case-insensitive) types are allowed:
* GEOMETRYCOLLECTION
* 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::
$ sqlite-utils create-spatial-index spatial.db locations geometry