Home

Awesome

<img src="https://docs.geodesk.com/img/github-header.png">

GeoDesk is a fast and storage-efficient geospatial database for OpenStreetMap data. Also available for Python and for Java.

Why GeoDesk?

Get Started

Requirements

Build & Install

GeoDesk has no dependencies and can be built with CMake:

git clone https://github.com/clarisma/libgeodesk.git
cd libgeodesk
mkdir build
cd build
cmake ..
cmake --build .

To install (optional):

cmake --install .

Create a GOL

Create a Geographic Object Library based on any .osm.pbf file, using the GOL Tool (Requires Java 16+).

For example:

gol build switzerland switzerland-latest.osm.pbf

Example Application

Find all the pubs in Zurich (Switzerland) and print their names:

#include <geodesk.h>

using namespace geodesk;

int main(int argc, char* argv[])
{
    // Open switzerland.gol
    Features features("switzerland");      

    // Get the feature that represents the area of the city of Zurich
    Feature zurich = features(
        "a[boundary=administrative][admin_level=8]"
        "[name:en=Zurich]").one();

    // Define a set that contains nodes and areas that are pubs
    Features pubs = features("na[amenity=pub]");

    // Iterate through the pubs that are contained 
    // in the area of Zurich and print their names
    for (Feature pub: pubs.within(zurich)
    {
        std::cout << pub["name"] << std::endl;
    }
}

More Examples

Find all movie theaters within 500 meters from a given point:

Features movieTheaters = features("na[amenity=cinema]")
    .maxMetersFromLonLat(500, myLon, myLat);

Remember, OSM uses British English for its terminology.

Discover the bus routes that traverse a given street:

for (Relation route: street.parents("[route=bus]"))
{
    std::cout << route["ref"] 
        << " from " << route["from"] 
        << " to " << route["to"] << std::endl;
}

Count the number of entrances of a building:

int numberOfEntrances = building.nodes("[entrance]").count();

Documentation

Related Repositories


OpenStreetMap is a trademark of the OpenStreetMap Foundation, and is used with their permission. GeoDesk is not endorsed by or affiliated with the OpenStreetMap Foundation.