GeoDex is our new open utility for finding satellite imagery. It helps find imagery within a user-defined geospatial boundary (e.g., a city, province, or country) without using excessive memory.
We originally built GeoDex as part of our effort to map high voltage infrastructure (described here and here). During that work, we needed to find and process country-wide image sets at zoom level 18 – tens of millions of images. Our existing tool crashed (due to memory overloads) when trying to find imagery at that scale. Other groups have developed tools that scale more efficiently, but we found that these only operated on rectangular boundaries. On non-rectangular regions, these tools draw a bounding box around the area of interest before searching for imagery. Depending on the irregularity of a region’s shape, this can result in a large volume of unwanted imagery and therefore waste computational resources.
GeoDex can handle irregular (or multiple) boundaries properly while maintaining a small memory footprint. GeoDex takes advantage of the fact that satellite imagery is often organized according to a tiled map service where each image is indexed according to a standardized tiling scheme.
By traversing this tile structure intelligently, it’s possible to store only a few dozen tile indices in memory at any time. GeoDex uses a depth-first search algorithm that never uses more than a few kilobytes of RAM (no matter how big the region or high the zoom). A toy example below demonstrates how the algorithm progresses through tiles indices.
A user can define any arbitrary geospatial boundary (or set of boundaries) and desired zoom level, and GeoDex will return the tile indices for satellite imagery overlapping the region(s) of interest. It’s possible to then download the corresponding images and process them locally or feed this list to a cloud-based based pipeline. In our high voltage project for example, we applied a machine learning classifier on the cloud to all imagery from Pakistan, Nigeria, and Zambia to find high voltage towers. The tower locations were then passed on to our Data Team to guide their tracing of the high voltage infrastructure.
We’re making GeoDex open-source in the spirit of our Greenhouse initiative to share the tools we develop for our partners. Code and examples for GeoDex are openly available on Github. You can install and use it from the command line as follows:
pip install geodex geodex my_boundary.geojson 15 'tms' > my_boundary_z15_tms_indices.txt
GeoDex is built on top of pyGeoTile and has some similar functionality to Mercantile. GeoDex has the advantage of working on arbitrarily shaped boundaries and more than one boundary within the same GeoJSON file. If you need tile indices for only a single rectangular region however, Mercantile will give the same output and compute more quickly. Feedback or contributions are always welcome on the Github repository.