Skip to main content

datasette-leaflet-freedraw

PyPI Changelog Tests License

Draw polygons on maps in Datasette

Project background: Drawing shapes on a map to query a SpatiaLite database.

Installation

Install this plugin in the same environment as Datasette.

$ datasette install datasette-leaflet-freedraw

Usage

If a table has a SpatiaLite geometry column, the plugin will add a map interface to the table page allowing users to draw a shape on the map to find rows with a geometry that intersects that shape.

The plugin can also work with arbitrary SQL queries. There it looks for input fields with a name of freedraw or that ends in _freedraw and replaces them with a map interface.

The map interface uses the FreeDraw Leaflet plugin.

Demo

You can try out this plugin to run searches against the GreenInfo Network California Protected Areas Database. Here's an example query showing mini parks in San Francisco:

select
  AsGeoJSON(geometry), *
from
  CPAD_2020a_SuperUnits
where
  PARK_NAME like '%mini%' and
  Intersects(GeomFromGeoJSON(:freedraw), geometry) = 1
  and CPAD_2020a_SuperUnits.rowid in (
    select
      rowid
    from
      SpatialIndex
    where
      f_table_name = 'CPAD_2020a_SuperUnits'
      and search_frame = GeomFromGeoJSON(:freedraw)
  )

Screenshot of the plugin in action

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-leaflet-freedraw
python3 -mvenv venv
source venv/bin/activate

Or if you are using pipenv:

pipenv shell

Now install the dependencies and tests:

pip install -e '.[test]'

To run the tests:

pytest

Metadata

Release files for datasette-leaflet-freedraw 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-leaflet-freedraw 0.3.1
File Size Uploaded Provenance Actions
datasette-leaflet-freedraw-0.3.1.tar.gz 1.0 MB Without provenance Details for datasette-leaflet-freedraw-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datasette-leaflet-freedraw 0.3.1
File Interpreter ABI Platform Actions
datasette_leaflet_freedraw-0.3.1-py3-none-any.whl Python 3 none any Details for datasette_leaflet_freedraw-0.3.1-py3-none-any.whl

Total release size: 2.1 MB

Release files / datasette-leaflet-freedraw-0.3.1.tar.gz

Download URL datasette-leaflet-freedraw-0.3.1.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
7ee5d14a5804f834e2ee3b8e07e4fc6faa8725ae0cf9707f51a4b9ed3217454a
BLAKE2b-256 checksum
How to use checksums
7d396bed00aa8b0937dab22533ed0bfa7df6eb79d353ffbdec2b0bd3b683915b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / datasette_leaflet_freedraw-0.3.1-py3-none-any.whl

Download URL datasette_leaflet_freedraw-0.3.1-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fa2043b3318d3a44509d783596b90acd2e0ca0d9bd446033ed518249f995bef9
BLAKE2b-256 checksum
How to use checksums
e5d1b1f34ad7116e980d0921b2f5025c02e37decf5603b97fede43d51fe989a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Security for datasette-leaflet-freedraw 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page