Instructions to use gursoyfurkan/CartoVec with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use gursoyfurkan/CartoVec with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy), and from_pretrained_keras was removed in huggingface_hub 1.0. # See https://github.com/keras-team/tf-keras for more details. # !pip install "huggingface_hub<1.0" tf_keras from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("gursoyfurkan/CartoVec") - Notebooks
- Google Colab
- Kaggle
CartoVec: General-Purpose Location Embeddings from Open Map Data
CartoVec maps latitude and longitude to a 64-dimensional location embedding. It learns environmental context from structured Overture Maps attributes, without image inputs or downstream-task labels. Inference requires only coordinates, with no map lookup.
Paper: CartoVec: General-Purpose Location Embeddings from Open Map Data
Model Details
- Author: Furkan Gursoy
- Input: Latitude and longitude in degrees, ordered
[latitude, longitude] - Output: A 64-dimensional, L2-normalized embedding
- Model format: TensorFlow SavedModel, including trained weights and the inference graph
- Coverage: New York, New Jersey, Pennsylvania, Delaware, Maryland, Connecticut, Rhode Island, Massachusetts, Vermont, New Hampshire and the District of Columbia
Usage
Install the dependencies:
pip install "tensorflow==2.16.2" huggingface_hub
Download and load the encoder:
import tensorflow as tf
from huggingface_hub import snapshot_download
model_path = snapshot_download(
repo_id="gursoyfurkan/CartoVec",
allow_patterns=["saved_model.pb", "variables/*"],
)
model = tf.saved_model.load(model_path)
encode = model.signatures["serving_default"]
# Coordinates in degrees, ordered [latitude, longitude].
coordinates = tf.constant(
[
[40.7128, -74.0060], # New York City
[42.3601, -71.0589], # Boston
],
dtype=tf.float32,
)
embeddings = encode(latlon=coordinates)["embedding"].numpy()
print(embeddings.shape) # (2, 64)
Each row is an L2-normalized location embedding. The model accepts batches of coordinates and requires no map data at inference.
Tested with TensorFlow 2.16.2.
Training
The encoder was trained on approximately 30.7 million sampled coordinates to predict land, water, land cover, land use, transportation and place attributes.
Intended Use
Use CartoVec embeddings as fixed location features in downstream machine-learning models. Individual coordinates can be embedded directly; embeddings sampled within a geographic area can be averaged to represent that area.
Evaluation
The accompanying study evaluates frozen embeddings on six Census outcomes, Airbnb prices and Philadelphia crime counts using five-fold spatial block cross-validation. CartoVec achieves the highest mean performance on five of six Census targets and the highest average across the eight tasks, with several close comparisons.
Scope and Limitations
This checkpoint covers the study region listed above; it is not a globally trained model. It reflects the map snapshot used for training, and its usefulness depends on map coverage and the downstream task. Applications involving consequential decisions require task-specific validation and fairness assessment.
Citation
If you use CartoVec in your research, please cite:
@misc{gursoy2026cartovec,
title = {{CartoVec}: General-Purpose Location Embeddings from Open Map Data},
author = {Furkan Gursoy},
year = {2026},
eprint = {2610.17190},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2610.17190}
}
License
CartoVec model weights are distributed under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0).
Noncommercial use, modification and redistribution are permitted subject to attribution and the other license terms. Commercial use is not licensed under these terms. Contact Furkan Gursoy to request separate written permission for commercial use.
- Downloads last month
- 10