News for hackers. Stuff that matters.
Re:Pbf2sqlite: Reading OpenStreetMap into a SQLite Database by milliams on Tuesday July 01, 2025 @09:50AM (#44433924)
Does SQLite have GIS capabilities (like PostGIS provides for Postgres), or is this storing the data as traditional database primitives?
Re:Pbf2sqlite: Reading OpenStreetMap into a SQLite Database by fros1y on Tuesday July 01, 2025 @10:03AM (#44434028)
Re:Pbf2sqlite: Reading OpenStreetMap into a SQLite Database by 0cf8612b2e1e on Tuesday July 01, 2025 @02:26PM (#44436739)
DuckDB has put some effort into GIS, so if SQLite does not immediately fit the bill, I would go there.

https://motherduck.com/blog/getting-started-gis-duckdb/

Re:Pbf2sqlite: Reading OpenStreetMap into a SQLite Database by Scaevolus on Tuesday July 01, 2025 @05:14PM (#44438060)
SQLite can be built with the R*tree module, which supports efficiently looking up all bounding boxes that contain a point: https://www.sqlite.org/rtree.html

PostGIS similarly provides an R*Tree index mode, as well as a heap of functions for doing GIS calculations directly. To do that in SQLite, you'd implement and inject custom functions as appropriate.

Re:Pbf2sqlite: Reading OpenStreetMap into a SQLite Database by simonw on Thursday July 03, 2025 @02:16PM (#44457779)
From the schema it looks like this is storing nodes and lines: https://github.com/osmzoso/pbf2sqlite/blob/main/doc/pbf2sqli...

There's an option to enable RTree indexes to speed up queries like this one:

  SELECT way_id
  FROM rtree_way
  WHERE max_lon>= 7.851 AND min_lon<= 7.854
   AND  max_lat>=47.995 AND min_lat<=47.996;
Re:Pbf2sqlite: Reading OpenStreetMap into a SQLite Database by wiredfool on Thursday July 03, 2025 @02:22PM (#44457839)
SQLite + spatial (and specific metadata tables) is essentially the Geopackage format, which can be considered the modern equivalent of a shapefile.

Which is to say, yes, SQLite has geospatial operations and they’re well supported by the open source gis stack.