Render a map for any query with a geometry column
Project description
datasette-geojson-map
Render a map for any query with a geometry column
Installation
Install this plugin in the same environment as Datasette.
$ datasette install datasette-geojson-map
Usage
Start by loading a GIS file.
For example, you might use geojson-to-sqlite or shapefile-to-sqlite to load neighborhood boundaries into a SQLite database.
wget -O neighborhoods.geojson https://opendata.arcgis.com/datasets/3525b0ee6e6b427f9aab5d0a1d0a1a28_0.geojson
geojson-to-sqlite boston.db neighborhoods neighborhoods.geojson --spatial-index # create a spatial index
(The command above uses Spatialite, but that's not required.)
Start up datasette
and navigate to the neighborhoods
table.
datasette serve boston.db --load-extension spatialite
# in another terminal tab
open http://localhost:8001/boston/neighborhoods
You should see a map centered on Boston with each neighborhood outlined. Clicking a boundary will bring up a popup with details on that feature.
This plugin relies on (and will install) datasette-geojson. Any query that includes a geometry
column will produce a map of the results. This also includes single row views.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-geojson-map
python3 -mvenv venv
source venv/bin/activate
Or if you are using pipenv
:
pipenv shell
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for datasette-geojson-map-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 948147c3ad1868e317efd79c91574bb3db22c076c8a7c776e82a0e2f0956a665 |
|
MD5 | ce4e0dbdf7f342da317e85ff623c9655 |
|
BLAKE2b-256 | 67cb4aa736cb1c4f1d0b71bbe88597a9f4a730b9ab85371aa3a5f99c7ad29c13 |
Hashes for datasette_geojson_map-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81d2f1958c5eef993c59109871610316fb39972b8c9f6a5de282c6986777f7dd |
|
MD5 | 8981ff81d35ec750046694fb9062ee21 |
|
BLAKE2b-256 | 8707e6644e6d33fd0ec6809a10e49cba99f9e6d83d8cdd9f80d248cb725ca4d4 |