{"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-1074479768", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 1074479768, "node_id": "IC_kwDOBm6k_c5AC0KY", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-21T22:22:20Z", "updated_at": "2022-03-21T22:22:20Z", "author_association": "OWNER", "body": "I'm closing this issue because this is now solved by a number of neat plugins:\r\n\r\n- https://datasette.io/plugins/datasette-geojson-map shows the geometry from SpatiaLite columns on a map\r\n- https://datasette.io/plugins/datasette-leaflet-geojson can be used to display inline maps next to each column", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-744461856", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 744461856, "node_id": "MDEyOklzc3VlQ29tbWVudDc0NDQ2MTg1Ng==", "user": {"value": 296686, "label": "robintw"}, "created_at": "2020-12-14T14:04:57Z", "updated_at": "2020-12-14T14:04:57Z", "author_association": "NONE", "body": "I'm looking into using datasette with a database with spatialite geometry columns, and came across this issue. Has there been any progress on this since 2018?\r\n\r\nIn one of my tables I'm just storing lat/lon points in a spatialite point geometry, and I've managed to make datasette-cluster-map display the points by extracting the lat and lon in SQL - using something like `select ... ST_X(location) as longitude, ST_Y(location) as latitude from Blah`. Something more 'built-in' would be great though - particularly for the tables I have that store more complex geometries.", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-401312981", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 401312981, "node_id": "MDEyOklzc3VlQ29tbWVudDQwMTMxMjk4MQ==", "user": {"value": 45057, "label": "russss"}, "created_at": "2018-06-29T10:14:54Z", "updated_at": "2018-06-29T10:14:54Z", "author_association": "CONTRIBUTOR", "body": "> @RusSs Different map projections can presumably be handled on the client side using a leaflet plugin to transform the geometry (eg kartena/Proj4Leaflet) although the leaflet side would need to detect or be informed of the original projection?\r\n\r\nWell, as @simonw mentioned, GeoJSON only supports WGS84, and GeoJSON (and/or TopoJSON) is the standard we probably want to aim for. On-the-fly reprojection in spatialite is not an issue anyway, and in general I think you want to be serving stuff to web maps in WGS84 or Web Mercator.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-401310732", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 401310732, "node_id": "MDEyOklzc3VlQ29tbWVudDQwMTMxMDczMg==", "user": {"value": 82988, "label": "psychemedia"}, "created_at": "2018-06-29T10:05:04Z", "updated_at": "2018-06-29T10:07:25Z", "author_association": "CONTRIBUTOR", "body": "@russs Different map projections can presumably be handled on the client side using a leaflet plugin to transform the geometry (eg [kartena/Proj4Leaflet](https://kartena.github.io/Proj4Leaflet/)) although the leaflet side would need to detect or be informed of the original projection?\r\n\r\nAnother possibility would be to provide an easy way/guidance for users to create an FK'd table containing the WGS84 projection of a non-WGS84 geometry in the original/principle table? This could then as a proxy for serving GeoJSON to the leaflet map?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-393106520", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 393106520, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MzEwNjUyMA==", "user": {"value": 45057, "label": "russss"}, "created_at": "2018-05-30T10:09:25Z", "updated_at": "2018-05-30T10:09:25Z", "author_association": "CONTRIBUTOR", "body": "I don't think it's unreasonable to only support spatialite geometries in a coordinate reference system which is at least transformable to WGS84. It would be nice to support different CRSes in the database so conversion to spatialite from the source data is lossless.\r\n\r\nI think the working CRS for datasette should be WGS84 though (leaflet requires it, for example) - it's just a case of calling `ST_Transform(geom, 4326)` on the column while we're loading the data.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-393014943", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 393014943, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MzAxNDk0Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-30T02:59:53Z", "updated_at": "2018-05-30T02:59:53Z", "author_association": "OWNER", "body": "I just realised a problem with GeoJSON is that it assumes that the underlying geometry is WGS 84 latitude/longitude points - but it's very possible for a SpatiaLite geometry to contain geometric data that's nothing to do with geospatial projections.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-392969173", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 392969173, "node_id": "MDEyOklzc3VlQ29tbWVudDM5Mjk2OTE3Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-29T22:32:08Z", "updated_at": "2018-05-29T22:32:08Z", "author_association": "OWNER", "body": "The more time I spend with SpatiaLite the more convinced I am that this should be default behavior. There's nothing useful about the binary Geometry representation - it's not even valid WKB. I'm on board with WKT as the default display in HTML and GeoJSON as the default for `.json`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-392825746", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 392825746, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MjgyNTc0Ng==", "user": {"value": 45057, "label": "russss"}, "created_at": "2018-05-29T15:42:53Z", "updated_at": "2018-05-29T15:42:53Z", "author_association": "CONTRIBUTOR", "body": "I haven't had time to look further into this, but if doing this as a plugin results in useful hooks then I think we should do it that way. We could always require the plugin as a standard dependency. \r\n\r\nI think this is going to result in quite a bit of refactoring anyway so it's a good time to add hooks regardless. \r\n\r\nOn the other hand, if we have to add lots of specialist hooks for it then maybe it's worth integrating into the core.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-392815673", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 392815673, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MjgxNTY3Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-29T15:17:04Z", "updated_at": "2018-05-29T15:17:04Z", "author_association": "OWNER", "body": "I'm coming round to the idea that this should be baked into Datasette core - see above referenced issues for some of the explorations I've been doing around this area.\r\n\r\nDatasette should absolutely work without SpatiaLite, but it's such a huge bonus part of the SQLite ecosystem that I'm happy to ship features that take advantage of it without being relegated to plugins.\r\n\r\nI'm also becoming aware that there aren't really that many other interesting loadable extensions for SQLite. If SpatiaLite was one of dozens I'd feel that a rule that \"anything dependent on an extension lives in a plugin\" would make sense, but as it stands I think 99% of the time the only loadable extensions people will be using will be SpatiaLite and json1 (and json1 is available in the amalgamation anyway).\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-392316306", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 392316306, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MjMxNjMwNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-27T09:00:46Z", "updated_at": "2018-05-27T09:00:46Z", "author_association": "OWNER", "body": "Relevant to this ticket: I've been playing with a plugin that automatically renders any GeoJSON cells as leaflet maps: https://github.com/simonw/datasette-leaflet-geojson", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-392316250", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 392316250, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MjMxNjI1MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-27T08:59:46Z", "updated_at": "2018-05-27T08:59:46Z", "author_association": "OWNER", "body": "It looks like we can use the `geometry_columns` table to introspect which columns are SpatiaLite geometries. It includes a `geometry_type` integer which is documented here: https://www.gaia-gis.it/fossil/libspatialite/wiki?name=switching-to-4.0", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-392279644", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 392279644, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MjI3OTY0NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-26T18:34:21Z", "updated_at": "2018-05-26T18:34:21Z", "author_association": "OWNER", "body": "I've been thinking a bit about modifying the SQL select statement used for the table view recently. I've run into a few examples of SQLite database that slow to a crawl when viewed with datasette because the rows are too big, so there's definitely scope for supporting custom select clauses (avoiding some columns, showing length(colname) for others).", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-392279508", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 392279508, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MjI3OTUwOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-26T18:32:07Z", "updated_at": "2018-05-26T18:32:07Z", "author_association": "OWNER", "body": "Related: I started the documentation for using SpatiaLite with Datasette here: https://datasette.readthedocs.io/en/latest/spatialite.html", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-391505930", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 391505930, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MTUwNTkzMA==", "user": {"value": 45057, "label": "russss"}, "created_at": "2018-05-23T21:41:37Z", "updated_at": "2018-05-23T21:41:37Z", "author_association": "CONTRIBUTOR", "body": "> I'm not keen on anything that modifies the SQLite file itself on startup\r\n\r\nAh I didn't mean that - I meant altering the SELECT query to fetch the data so that it ran a spatialite function to transform that specific column.\r\n\r\nI think that's less useful as a general-purpose plugin hook though, and it's not that hard to parse the WKB in Python (my default approach would be to use [shapely](https://github.com/Toblerity/Shapely), which is great, but geomet looks like an interesting pure-python alternative).", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-391504757", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 391504757, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MTUwNDc1Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-23T21:37:07Z", "updated_at": "2018-05-23T21:37:18Z", "author_association": "OWNER", "body": "That said, it looks like we may be able to use a library like https://github.com/geomet/geomet to run the conversion from WKB entirely in Python space.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-391504199", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 391504199, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MTUwNDE5OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-23T21:35:17Z", "updated_at": "2018-05-23T21:35:17Z", "author_association": "OWNER", "body": "I'm not keen on anything that modifies the SQLite file itself on startup - part of the datasette contract is that it should work with any SQLite file you throw at it without having any side-effects.\r\n\r\nA neat thing about SQLite is that because everything happens in the same process there's very little additional overhead involved in executing extra SQL queries - even if we ran a query-per-row to transform data in one specific column it shouldn't add more than a few ms to the total page load time (whereas with MySQL all of the extra query overhead would kill us).", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-391050113", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 391050113, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MTA1MDExMw==", "user": {"value": 45057, "label": "russss"}, "created_at": "2018-05-22T16:13:00Z", "updated_at": "2018-05-22T16:13:00Z", "author_association": "CONTRIBUTOR", "body": "Yup, I'll have a think about it. My current thoughts are for spatialite we'll need to hook into the following places:\r\n\r\n* Inspection, so we can detect which columns are geometry columns. (We also currently ignore spatialite tables during inspection, it may be worth moving that to the plugin as well.)\r\n* After data load, so we can convert WKB into the correct intermediate format for display. The alternative here is to alter the select SQL itself and get spatialite to do this conversion, but that strikes me as a bit more complex and possibly not as useful.\r\n* HTML rendering.\r\n* Querying?\r\n\r\nThe rendering and querying hooks could also potentially be used to move the units support into a plugin.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-391025841", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 391025841, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MTAyNTg0MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-22T15:06:36Z", "updated_at": "2018-05-22T15:06:36Z", "author_association": "OWNER", "body": "The other reason I mention plugins is that I have an idea to outlaw JavaScript entirely from Datasette core and instead encourage ALL JavaScript functionality to move into plugins.right now that just means CodeMirror. I may set up some of those plugins (like CodeMirror) as default dependencies so you get them from \"pip install datasette\".\r\n\r\nI like the neatness of saying that core Datasette is a very simple JSON + HTML application, then encouraging people to go completely wild with JavaScript in the plugins.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-391000659", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 391000659, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MTAwMDY1OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-22T13:59:27Z", "updated_at": "2018-05-22T13:59:27Z", "author_association": "OWNER", "body": "Right now the plugin stuff is early enough that I'd like to get as many potential plugin hooks as possible crafted out A much easier to judge if they should be added as actual hooks if we have a working branch prototype of them.\r\n\r\nSome kind of mechanism for custom column display is already needed - eg there are columns where I want to say \"render this as markdown\" or \"URLify any links in this text\" - or even \"use this date format\" or \"add commas to this integer\".\r\n\r\nYou can do it with a custom template but a lower-level mechanism would be nicer. ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-390795067", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 390795067, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MDc5NTA2Nw==", "user": {"value": 45057, "label": "russss"}, "created_at": "2018-05-21T21:55:57Z", "updated_at": "2018-05-21T21:55:57Z", "author_association": "CONTRIBUTOR", "body": "Well, we do have the capability to detect spatialite so my intention certainly wasn't to require it. \r\n\r\nI can see the advantage of having it as a plugin but it does touch a number of points in the code. I think I'm going to attack this by refactoring the necessary bits and seeing where that leads (which was my plan anyway).\r\n\r\nI think my main concern is - if I add certain plugin hooks for this, is anything else ever going to use them? I'm not sure I have an answer to that question yet, either way.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/276#issuecomment-390707760", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/276", "id": 390707760, "node_id": "MDEyOklzc3VlQ29tbWVudDM5MDcwNzc2MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2018-05-21T16:30:35Z", "updated_at": "2018-05-21T16:30:35Z", "author_association": "OWNER", "body": "This probably needs to be in a plugin simply because getting Spatialite compiled and installed is a bit of a pain.\r\n\r\nIt's a great opportunity to expand the plugin hooks in useful ways though.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 324835838, "label": "Handle spatialite geometry columns better"}, "performed_via_github_app": null}