Prototypes - whosonfirst-external-duckdb

This post describes a prototype for running an entirely self-contained application for querying venue data by name, neighbourhood and locality. All of the map (tile) data and location data are served from local datafiles (PMTiles and GeoParquet respectively). The location data is indexed and queried from a slightly-modified version of the DuckDB WebAssembly binary.

(It is “not fast but works” when run locally. When run over the network it still works but is noticeably slow. Also the DuckDB WASM binary is 30MB so maybe just run it locally.)

It is working code to try and identify the outlines for a series of open questions about how geo services should be exposed in an ATProto context. Importantly, this application is not ATProto-specific but may be a useful reference implementation for thinking through issues around data portability and reliance on third-party services (for example tiles) necessary for application-specific mechanics.

The hope is that this package, and others like, can be installed and run locally with minimal fuss, by ATProto developers looking to add geo functionality to their applications in order to define the needs and shape of geo-services with concrete examples and use-cases.

The package comes bundled with “canned” data files for the San Francisco Bay Area so the only thing necessary is a web server. The application itself is an entirely self-contained web application so any old web server will do.

I am mentioning it here since so many of the imagined use cases in the discussions for geo-related ATProto applications involve querying and rendering venue data. Once again, it is not a native ATProto/XRPC application but maybe the query/render logic under the hood can help inform an ATProto-specific discussion.

The application assumes Foursquare venue data which has been “reverse geocoded” in order to assign stable (Who’s On First) identifiers for neighbourhood and locality references. It could also work with Overture venue data but I haven’t gotten around to building that yet.

As mentioned the package is bundled with “canned” data files for the San Francisco Bay Area but there are also instructions for making custom data files. For example, I recently made one for Melbourne (AU). It’s not “easy” yet but it is possible.

The code itself is here:

1 Like