GeoVectors Framework
You can access the code for the GeoVectors embedding generation framework on GitHub.
Prerequisites
- Python >= 3.8
- Postgres DB with PostGIS
Setup
- Clone the repository
git clone https://github.com/NicolasTe/GeoVectors.git
cd GeoVectors - Install the Python Requirements
pip install -r requirements.txt
- Download the pretrained models
cd models/fasttext
./download.sh
cd ../nle
./download.sh - Setup the Postgres Database
psgql < geovectors_nle.sql
- 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
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
- Download the specific OpenStreetMap snapshot you want to encode, e.g., from https://download.geofabrik.de/. We recommend using the osm.pbf format.
- Run the tag embedding model:
python3 Encoder.py ./snapshots ./embeddings_tags ./models/fasttext --model fasttext
- Run the NLE embedding model:
python3 Encoder.py ./snapshots ./embeddings_nle ./models/nle --model nle --db_cred db.ini