{"id":13856692,"url":"https://github.com/eyeseast/datasette-geojson","last_synced_at":"2025-05-07T13:45:09.590Z","repository":{"id":43833811,"uuid":"374846311","full_name":"eyeseast/datasette-geojson","owner":"eyeseast","description":"Add GeoJSON output to Datasette queries","archived":false,"fork":false,"pushed_at":"2024-01-13T01:00:15.000Z","size":2296,"stargazers_count":13,"open_issues_count":7,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-19T06:41:44.711Z","etag":null,"topics":["datasette-io","datasette-plugin","geojson","gis","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eyeseast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-06-08T01:33:19.000Z","updated_at":"2024-11-14T11:09:30.000Z","dependencies_parsed_at":"2024-01-16T09:11:55.569Z","dependency_job_id":null,"html_url":"https://github.com/eyeseast/datasette-geojson","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":"0.045454545454545414","last_synced_commit":"6f66024665e9d2c2dcbfd02edeeda704704baf11"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eyeseast","download_url":"https://codeload.github.com/eyeseast/datasette-geojson/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252889615,"owners_count":21820214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datasette-io","datasette-plugin","geojson","gis","sqlite"],"created_at":"2024-08-05T03:01:09.165Z","updated_at":"2025-05-07T13:45:09.527Z","avatar_url":"https://github.com/eyeseast.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# datasette-geojson\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-geojson.svg)](https://pypi.org/project/datasette-geojson/)\n[![Changelog](https://img.shields.io/github/v/release/eyeseast/datasette-geojson?include_prereleases\u0026label=changelog)](https://github.com/eyeseast/datasette-geojson/releases)\n[![Tests](https://github.com/eyeseast/datasette-geojson/workflows/Test/badge.svg)](https://github.com/eyeseast/datasette-geojson/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/eyeseast/datasette-geojson/blob/main/LICENSE)\n\nAdd GeoJSON as an output option for datasette queries.\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n\n    datasette install datasette-geojson\n\n## Usage\n\nTo render GeoJSON, add a `.geojson` extension to any query URL that includes a `geometry` column. That column should be a valid [GeoJSON geometry](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1).\n\nFor example, you might use [geojson-to-sqlite](https://pypi.org/project/geojson-to-sqlite/) or [shapefile-to-sqlite](https://pypi.org/project/shapefile-to-sqlite/) to load [neighborhood boundaries](https://bostonopendata-boston.opendata.arcgis.com/datasets/3525b0ee6e6b427f9aab5d0a1d0a1a28_0/explore) into a SQLite database.\n\n```sh\nwget -O neighborhoods.geojson https://opendata.arcgis.com/datasets/3525b0ee6e6b427f9aab5d0a1d0a1a28_0.geojson\ngeojson-to-sqlite boston.db neighborhoods neighborhoods.geojson --spatial-index # create a spatial index\ndatasette serve boston.db --load-extension spatialite\n```\n\nIf you're using Spatialite, the geometry column will be in a binary format. If not, make sure the `geometry` column is a well-formed [GeoJSON geometry](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1). If you used `geojson-to-sqlite` or `shapefile-to-sqlite`, you should be all set.\n\nRun this query in Datasette and you'll see a link to download GeoJSON:\n\n```sql\nselect\n  rowid,\n  OBJECTID,\n  Name,\n  Acres,\n  Neighborhood_ID,\n  SqMiles,\n  ShapeSTArea,\n  ShapeSTLength,\n  geometry\nfrom\n  neighborhoods\norder by\n  rowid\nlimit\n  101\n```\n\nNote that the geometry column needs to be explicitly _named_ `geometry` or you won't get the option to export GeoJSON. If you want to use a different column, rename it with `AS`: `SELECT other AS geometry FROM my_table`.\n\n![export geojson](img/export-options.png)\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n\n    cd datasette-geojson\n    python3 -mvenv venv\n    source venv/bin/activate\n\nOr if you are using `pipenv`:\n\n    pipenv shell\n\nNow install the dependencies and tests:\n\n    pip install -e '.[test]'\n\nTo run the tests:\n\n    pytest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyeseast%2Fdatasette-geojson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feyeseast%2Fdatasette-geojson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyeseast%2Fdatasette-geojson/lists"}