This is a demo project showing how I use SpatiaLite with Datasette for quick spatial analysis, based on Peter Aldhous' 2022 NICAR session. To see this done in R, follow Peter's tutorial.
- datasette
- sqlite-utils
- geojson-to-sqlite
- datasette-geojson
- datasette-geojson-map
- sqlite-colorbrewer
- geocode-sqlite will run a geocoder on every row in a table, saving the results to
latitude
andlongitude
columns.
Run pipenv install
to create a virtual environment and get the latest version of everything. I also recommend installing SpatiaLite.
Run make install
to load dependencies from Pipfile.lock
. This should recreate the same environment every time.
Once that's done, run make quakes.db
to create a SpatiaLite database and load in seismic risk data.
To geocode the addresses
table, run make geocode
, which will use OpenStreetMap's nominatim geocoder. This is fine for a 30-row table, but for larger datasets, consider a different geocoder.
Run the Datasette server using make run
and open http://localhost:8001
.