GeoVectors – a Linked Open Corpus of OpenStreetMap Embeddings

GeoVectors Framework

You can access the code for the GeoVectors embedding generation framework on GitHub.

Prerequisites

Setup

  1. Clone the repository
    git clone https://github.com/NicolasTe/GeoVectors.git
    cd GeoVectors
  2. Install the Python Requirements
    pip install -r requirements.txt
  3. Download the pretrained models
    cd models/fasttext
    ./download.sh
    cd ../nle
    ./download.sh
  4. Setup the Postgres Database
    psgql < geovectors_nle.sql
  5. Adjust the database credentials in the db.ini file.

Usage

Encoder.py [-h] [--db_cred DB_CRED] [--model MODEL] [--njobs NJOBS] input output modelPath positional arguments:
  input Input: directory containing OpenStreetMap snapshots to be encoded
  output Directory to save encoded files
  modelPath Path to pretrained model

optional arguments:
  -h, --help show this help message and exit
  --db_cred DB_CRED Credentials for the database
  --model MODEL Name of the embedding model. Either fasttext or nle
  --njobs NJOBS Number of threads to use
  1. Download the specific OpenStreetMap snapshot you want to encode, e.g., from https://download.geofabrik.de/. We recommend using the osm.pbf format.
  2. Run the tag embedding model:
    python3 Encoder.py ./snapshots ./embeddings_tags ./models/fasttext --model fasttext
  3. Run the NLE embedding model:
    python3 Encoder.py ./snapshots ./embeddings_nle ./models/nle --model nle --db_cred db.ini