Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow drawing on a map on table pages for tables with a geometry column #8

Merged
merged 8 commits into from
Dec 17, 2021

Conversation

simonw
Copy link
Owner

@simonw simonw commented Dec 17, 2021

Refs #7, simonw/datasette#473 and simonw/datasette#1559

Still needed:

  • Run JavaScript on table page (if a geometry column is present) and show the map
  • Release of Datasette with the new filters_from_request plugin hook that this uses
  • Tests
  • Updated documentation

@simonw simonw added enhancement New feature or request research labels Dec 17, 2021
@simonw simonw changed the title Initial prototype of filters_from_request on table page Allow drawing on a map on table pages for tables with a geometry column Dec 17, 2021
@simonw
Copy link
Owner Author

simonw commented Dec 17, 2021

Tests are failing because from datasette.filters import FilterArguments only works if you are running against the Datasette branch with that feature in.

@simonw
Copy link
Owner Author

simonw commented Dec 17, 2021

Not sure why that fix didn't work.

@simonw
Copy link
Owner Author

simonw commented Dec 17, 2021

OK, this works pretty well:

table-map

@simonw
Copy link
Owner Author

simonw commented Dec 17, 2021

The tests are a bit tricky because ideally I'd like to have SpatiaLite installed so I can test the new geometry_columns_for_table function.

geojson-to-sqlite has a solution for this, it's actually nice and simple: https://github.com/simonw/geojson-to-sqlite/blob/13c4e5ac0b7b6551e88432fe0e9e108bde0208f4/.github/workflows/test.yml#L24-L26

    - name: Install SpatiaLite
      run: |
        sudo apt-get install libsqlite3-mod-spatialite

@simonw
Copy link
Owner Author

simonw commented Dec 17, 2021

Can depend on this 0.60a0 alpha release now: https://docs.datasette.io/en/latest/changelog.html#a0-2021-12-17

@simonw
Copy link
Owner Author

simonw commented Dec 17, 2021

What's the quickest way to programmatically create a valid SQLite database geometry table with and without a spatial index configured I wonder?

https://github.com/simonw/geojson-to-sqlite probably.

@simonw
Copy link
Owner Author

simonw commented Dec 17, 2021

In this:

SELECT AddGeometryColumn('mytable', 'geometry', 4326, 'POINT', 'XY');

That XY means "2 dimensional".

@simonw
Copy link
Owner Author

simonw commented Dec 17, 2021

@simonw simonw merged commit 0b78034 into main Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant