{"id":13856694,"url":"https://github.com/eyeseast/datasette-geojson-map","last_synced_at":"2025-07-22T05:33:34.334Z","repository":{"id":43814711,"uuid":"382986564","full_name":"eyeseast/datasette-geojson-map","owner":"eyeseast","description":"Render a map for any query with a geometry column","archived":false,"fork":false,"pushed_at":"2024-08-10T21:47:47.000Z","size":5591,"stargazers_count":27,"open_issues_count":17,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-18T12:40:51.783Z","etag":null,"topics":["datasette-io","datasette-plugin","geojson","gis","leafletjs","mapping"],"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-05T01:54:13.000Z","updated_at":"2025-07-01T14:41:46.000Z","dependencies_parsed_at":"2024-10-24T19:35:18.530Z","dependency_job_id":null,"html_url":"https://github.com/eyeseast/datasette-geojson-map","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":0.05882352941176472,"last_synced_commit":"88b615cfd06471924ab454ff0246143c7fe060d4"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/eyeseast/datasette-geojson-map","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eyeseast","download_url":"https://codeload.github.com/eyeseast/datasette-geojson-map/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyeseast%2Fdatasette-geojson-map/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266433657,"owners_count":23927791,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","leafletjs","mapping"],"created_at":"2024-08-05T03:01:09.211Z","updated_at":"2025-07-22T05:33:34.314Z","avatar_url":"https://github.com/eyeseast.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# datasette-geojson-map\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-geojson-map.svg)](https://pypi.org/project/datasette-geojson-map/)\n[![Changelog](https://img.shields.io/github/v/release/eyeseast/datasette-geojson-map?include_prereleases\u0026label=changelog)](https://github.com/eyeseast/datasette-geojson-map/releases)\n[![Tests](https://github.com/eyeseast/datasette-geojson-map/workflows/Test/badge.svg)](https://github.com/eyeseast/datasette-geojson-map/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/eyeseast/datasette-geojson-map/blob/main/LICENSE)\n\nRender a map for any query with a geometry column\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n\n    $ datasette install datasette-geojson-map\n\n## Usage\n\nStart by loading a GIS file.\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\n```\n\n(The command above uses Spatialite, but that's not required.)\n\nStart up `datasette` and navigate to the `neighborhoods` table.\n\n```sh\ndatasette serve boston.db\n\n# in another terminal tab\nopen http://localhost:8001/boston/neighborhoods\n```\n\nYou should see a map centered on Boston with each neighborhood outlined. Clicking a boundary will bring up a popup with details on that feature.\n\n![Boston neighbhorhoods map](https://raw.githubusercontent.com/eyeseast/datasette-geojson-map/main/img/boston-neighborhoods-map.png)\n\nThis plugin relies on (and will install) [datasette-geojson](https://github.com/eyeseast/datasette-geojson). Any query that includes a `geometry` column will produce a map of the results. This also includes single row views.\n\nRun the included `demo` project to see it live.\n\n## Configuration\n\nThis project uses the same map configuration as [datasette-cluster-map](https://github.com/simonw/datasette-cluster-map). Here's how you would use [Stamen's terrain tiles](http://maps.stamen.com/terrain/#12/37.7706/-122.3782):\n\n```yaml\nplugins:\n  datasette-geojson-map:\n    tile_layer: https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.{ext}\n    tile_layer_options:\n      attribution: \u003e-\n        Map tiles by \u003ca href=\"http://stamen.com\"\u003eStamen Design\u003c/a\u003e, \n        under \u003ca href=\"http://creativecommons.org/licenses/by/3.0\"\u003eCC BY 3.0\u003c/a\u003e. \n        Data by \u003ca href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e, \n        under \u003ca href=\"http://www.openstreetmap.org/copyright\"\u003eODbL\u003c/a\u003e.\n      subdomains: abcd\n      minZoom: 1\n      maxZoom: 16\n      ext: jpg\n```\n\nOptions:\n\n- `tile_layer`: Use a URL template that can be passed to a [Leaflet Tilelayer](https://leafletjs.com/reference-1.7.1.html#tilelayer)\n- `tile_layer_options`: All options will be passed to the tile layer. See [Leaflet documentation](https://leafletjs.com/reference-1.7.1.html#tilelayer) for more on possible values here.\n\n## Styling map features\n\nMap features can be styled using the [simplestyle-spec](https://github.com/mapbox/simplestyle-spec). This requires setting specific fields on returned rows. Here's an example:\n\n```sql\nSELECT Name, geometry, \"#ff0000\" as fill, \"#0000ff\" as stroke, 0.2 as stroke-width,  from neighborhoods\n```\n\nThat will render a neighborhood map where each polygon is filled in red, outlined in blue and lines are 0.2 pixels wide.\n\nA more useful approach would use the `CASE` statement to color features based on data:\n\n```sql\nSELECT\n  Name,\n  geometry,\n  CASE\n    Name\n    WHEN \"Roslindale\" THEN \"#ff0000\"\n    WHEN \"Dorchester\" THEN \"#0000ff\"\n    ELSE \"#dddddd\"\n  END fill\nFROM\n  neighborhoods\n```\n\nThis will fill Roslindale in red, Dorchester in blue and all other neighborhoods in gray.\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-map\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 test dependencies:\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-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feyeseast%2Fdatasette-geojson-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyeseast%2Fdatasette-geojson-map/lists"}