Skip to main content

Render a map for any query with a geometry column

Project description

datasette-geojson-map

PyPI Changelog Tests License

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.

Boston neighbhorhoods map

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

datasette-geojson-map-0.2.1.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

datasette_geojson_map-0.2.1-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page