Papers › TorchSpatial: A Location Encoding Framework and Benchmark for Spatial Representation Learning

TorchSpatial: A Location Encoding Framework and Benchmark for Spatial Representation Learning

21 Jun 2024arXiv:2406.15658archive 2025-07-28

Nemin Wu, Qian Cao, Zhangyu Wang, Zeping Liu, Yanlin Qi, Jielu Zhang, Joshua Ni, Xiaobai Yao, Hongxu Ma, Lan Mu, Stefano Ermon, Tanuja Ganu, Akshay Nambi, Ni Lao, Gengchen Mai

Spatial representation learning (SRL) aims at learning general-purpose neural network representations from various types of spatial data (e.g., points, polylines, polygons, networks, images, etc.) in their native formats. Learning good spatial representations is a fundamental problem for various downstream applications such as species distribution modeling, weather forecasting, trajectory generation, geographic question answering, etc. Even though SRL has become the foundation of almost all geospatial artificial intelligence (GeoAI) research, we have not yet seen significant efforts to develop an extensive deep learning framework and benchmark to support SRL model development and evaluation. To fill this gap, we propose TorchSpatial, a learning framework and benchmark for location (point) encoding, which is one of the most fundamental data types of spatial representation learning. TorchSpatial contains three key components: 1) a unified location encoding framework that consolidates 15 commonly recognized location encoders, ensuring scalability and reproducibility of the implementations; 2) the LocBench benchmark tasks encompassing 7 geo-aware image classification and 10 geo-aware image regression datasets; 3) a comprehensive suite of evaluation metrics to quantify geo-aware model's overall performance as well as their geographic bias, with a novel Geo-Bias Score metric. Finally, we provide a detailed analysis and insights into the model performance and geographic bias of different location encoders. We believe TorchSpatial will foster future advancement of spatial representation learning and spatial fairness in GeoAI research. The TorchSpatial model framework and LocBench benchmark are available at https://github.com/seai-lab/TorchSpatial, and the Geo-Bias Score evaluation framework is available at https://github.com/seai-lab/PyGBS.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2406.15658")

Code

Syntology Ran 21 of 22 code samples harvested from 2 repositories linked to this paper; 1 has no recorded run. Of those that ran: 1 ran · violated contract; 3 ran · our draft was wrong; 1 ran · fixture could not drive it; 16 ran with no contract checked.

By repository: official repository: 22 samples from 2 repositories, 21 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

seai-lab/torchspatial officialmentioned in papermentioned on GitHubpytorchMIT report
seai-lab/pygbs officialmentioned in paperpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

22 samples harvested; 21 ran; 0 honoured the contract we drafted; 1 has no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
3ran · our draft was wrong
1ran · fixture could not drive it
16ran
1unverified

Licence: 0 of the 22 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

auto_density seai-lab/pygbs/baselines/gbsloss.py official repository ran MIT (permissive) · 757cdfd8757676b2 · report
bce_loss seai-lab/torchspatial/main/losses.py official repository ran fingerprinted MIT (permissive) · ee66019898426cda · report
compute_kl_sri seai-lab/pygbs/gbs/sri/sri_scores.py official repository ran MIT (permissive) · ce1886c7a705a294 · report
compute_mrr_by_lat seai-lab/torchspatial/main/eval_analysis.py official repository ran · fixture could not drive it fingerprinted MIT (permissive) · eccb2504e6bf75c5 · report
compute_mrr_by_latlongrid seai-lab/torchspatial/main/eval_analysis.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · f0c8a19e7f1331fe · report
compute_neighbor_prior seai-lab/torchspatial/main/baselines.py official repository ran MIT (permissive) · 48bee5af4d1cdfec · report
construct_weight_matrix seai-lab/pygbs/baselines/gbsloss.py official repository ran MIT (permissive) · 824c3511b683ed83 · report
create_kde_grid seai-lab/torchspatial/main/baselines.py official repository ran MIT (permissive) · ec0ef856ad8a26b0 · report
embed_l2_normalize seai-lab/torchspatial/main/losses.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 96cda1aea7b63917 · report
generate_background_points seai-lab/pygbs/baselines/gbsloss.py official repository ran MIT (permissive) · b84f15b1635ddbda · report
get_activation_function seai-lab/torchspatial/main/module.py official repository ran MIT (permissive) · 063ddd72ea995d8a · report
get_label_rank seai-lab/TorchSpatial/main/run_evaluation.py official repository ran · violated contract MIT (permissive) · d456c5cf4caf5297 · report
get_train_sample_ratio_tag seai-lab/torchspatial/main/data_utils.py official repository ran MIT (permissive) · fb680a92900a2a60 · report
hashable_loc seai-lab/torchspatial/main/baselines.py official repository ran MIT (permissive) · 28855eb94bf07f6e · report
load_bird_data seai-lab/torchspatial/main/datasets.py official repository ran MIT (permissive) · 65b7b5e57148522e · report
load_mask seai-lab/torchspatial/main/analysis.py official repository ran MIT (permissive) · 9d835b2cb9e2f146 · report
load_sparse_feats seai-lab/torchspatial/main/datasets.py official repository ran MIT (permissive) · 3cfd8e042f3a9170 · report
make_baseline_model_file seai-lab/torchspatial/main/analysis.py official repository ran MIT (permissive) · 05bbcdadb7f81960 · report
make_model_res_file seai-lab/torchspatial/main/data_utils.py official repository ran MIT (permissive) · d54c93139380fbe0 · report
make_sphere_model_file seai-lab/torchspatial/main/analysis.py official repository ran MIT (permissive) · 89fc1fad0c9b5226 · report
plot_locs seai-lab/torchspatial/main/eval_analysis.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · b6dbb6a8dbe80516 · report
get_classes_sample_idxs seai-lab/torchspatial/main/data_utils.py official repository unverified MIT (permissive) · 774c7aa6fadacf26 · report

Tasks

FairnessGeographic Question AnsweringImage ClassificationQuestion AnsweringRepresentation LearningWeather Forecastingimage-classification

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections