Introduction
Geospatial data—encompassing GPS coordinates, city boundaries, and traffic patterns—is a critical asset for modern machine learning. However, transforming raw location data into usable features is a notoriously difficult process. Tasks such as calculating the number of amenities within walking distance or determining proximity to infrastructure typically require managing massive datasets, handling complex spatial queries, and possessing significant computational power. Geomancer is an open-source Python framework designed to bridge this gap by providing a standardized, scalable, and shareable workflow for geospatial feature engineering.
The Geomancer Framework
Geomancer introduces a declarative approach to feature engineering through two primary concepts: Spells and SpellBooks. A "Spell" is the fundamental unit of the framework—a logical feature definition (e.g., "distance to the nearest primary road") that maps a coordinate to a specific value. Multiple Spells can be aggregated into a "SpellBook," which is exported as a JSON file. This allows teams to version-control and share feature engineering logic as easily as code or model weights.
The framework's architecture is designed to decouple logic from computation. Instead of processing data locally, Geomancer acts as a client that orchestrates queries within high-performance data warehouses such as Google BigQuery, PostGIS, or SpatiaLite. This "push-down" approach enables data scientists to engineer features on millions of rows from a standard laptop by leveraging the compute power of the warehouse where the data resides.
Case Study: Singapore Property Valuation
To demonstrate the framework's utility, the authors applied Geomancer to the task of predicting residential property prices in Singapore. Using a dataset of over 50,000 sales transactions from the Urban Redevelopment Authority (URA), they extracted 388 geospatial features using OpenStreetMap (OSM) and Waze data.
Results and Key Insights
The resulting model, utilizing a Random Forest regressor, achieved an 86% accuracy rate in predicting price per square foot, with an error margin kept within SGD 100. A key insight from this study was the importance of granular geospatial features over broad identifiers. While broad categories like "Postal District" accounted for 47% of the predictive power, adding specific proximity features (e.g., distance to restaurants, hotels, and ATMs) improved the model's performance by an additional 40 percentage points. This highlights that granular spatial context provides the "last mile" of accuracy and interpretability that coarse location IDs cannot capture.
Conclusion and Future Work
Geomancer simplifies the transition from raw spatial data to a clean feature matrix. By treating features as shareable configuration files and leveraging cloud-native compute, it empowers researchers to build more interpretable and reproducible models. Future development will focus on expanding backend support to include Amazon Athena and Redshift, as well as enriching the library of primitive features for specialized geospatial use cases.
Summary updated