GeoDesk for C++: Query OSM Data at Lightning Speed

Hi all,

We’re excited to announce the latest edition of our GeoDesk OpenStreetMap Toolkit, this time for C++. GeoDesk is a database engine specifically designed for OSM features, with an emphasis on fast queries and minimal hardware requirements.

This C++ library is lightweight (250 KB compiled), without any link-time dependencies. It supports Windows, Linux and MacOS. Its query engine runs entirely in-process, without any need for a database server or other external services. And, of course, it’s free and open-source.

All you need to get started is an .osm.pbf, which the GOL Tool turns into a compact database file (The full planet takes up less than 100 GB, imported in under an hour on any reasonably modern system).

Your application can then run queries such as this:

#include <geodesk/geodesk.h>

using namespace geodesk;

int main()
{
    // Find all cities with more than a million inhabitants
     
    Features world("path/to/world.gol");
    for(Feature city: world("n[place=city][population >= 1000000]"))
    {
        std::cout << city["name"] << std::endl;
    }
    return 0;   
}    

Just like its Java and Python cousins, GeoDesk for C++ supports a wide range of queries (within(), around(), crossing(), nodes of a way, members of a relation) and standard geospatial operations, such as computing areas and distances. For more advanced capabilities, you can also integrate it with the popular GEOS library.

This is still an early release, so it’s far from polished. The core codebase has been powering the GeoDesk Python module for more than a year, but we’re still refining the C++ API. As always, we’re grateful for bug reports and other suggestions for improvement.

What’s next?

If there is sufficient interest, we will also offer this library as a C API to enable foreign-function interface (FFI) integration. This would make it accessible to languages with FFI support, such as Go, Rust, Ruby and Perl.

We’ll keep you posted on our progress. Thanks for your interest & support!

3 Likes

Has the GOL tool been updated recently?

Only minor bugfixes. We’re working on a major release (based on the above toolkit), out in early 2015.

Are there any new features you’d like to see implemented?

2015?? :slightly_smiling_face: really?

3 Likes

Yep, we’re going back to the good old days, when software was fast and unbloated!

5 Likes