{"id":28956805,"url":"https://github.com/developmentseed/geodex","last_synced_at":"2025-06-23T21:40:55.444Z","repository":{"id":57433711,"uuid":"123906811","full_name":"developmentseed/geodex","owner":"developmentseed","description":"Find all geospatial tile indices contained in an arbitrary boundary at an arbitrary zoom","archived":false,"fork":false,"pushed_at":"2018-04-28T13:41:32.000Z","size":296,"stargazers_count":39,"open_issues_count":1,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-06T05:26:57.626Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developmentseed.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-05T10:58:38.000Z","updated_at":"2025-01-21T08:31:45.000Z","dependencies_parsed_at":"2022-08-28T03:01:48.797Z","dependency_job_id":null,"html_url":"https://github.com/developmentseed/geodex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/developmentseed/geodex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fgeodex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fgeodex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fgeodex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fgeodex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developmentseed","download_url":"https://codeload.github.com/developmentseed/geodex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fgeodex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261561180,"owners_count":23177543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-23T21:40:55.148Z","updated_at":"2025-06-23T21:40:55.419Z","avatar_url":"https://github.com/developmentseed.png","language":"Python","readme":"# GeoDex\n\nGeoDex is tool to find tile indices for geospatial work on satellite imagery. Given **(1)** a geojson file containing at least one polygon boundary and **(2)** a zoom level, GeoDex will return all satellite imagery [tile indices](http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/) that at least partially overlap the boundary. Returned tile indices can be written to a text file for further processing.\n\n## Installation\n`pip install geodex`\n\n## Basic usage example 1\nSpecify only a geojson file and zoom:\n```\ngeodex test/roi_single.geojson 12\n```\nReturns:\n```\n2494 2126 12\n2494 2125 12\n2493 2126 12\n2493 2125 12\n```\n## Basic usage example 2\nAlso specify output format string:\n```\ngeodex test/roi_single.geojson 12 'google' --output-format \"{z}-{x}-{y}\"\n```\nReturns:\n```\n12-2494-2126\n12-2494-2125\n12-2493-2126\n12-2493-2125\n```\n\n## Typical usage\nWrite output of boundary to text file\nNote that using `\u003e` like below will **overwrite** `tile_indices.txt` if it exists.\n```\ngeodex zone_1.geojson 15 'tms' \u003e tile_indices.txt\n```\n\nAvoid overwrite by **appending** multiple outputs to text file using `\u003e\u003e`\n```\ngeodex zone_1.geojson 15 'tms' \u003e\u003e tile_indices.txt\ngeodex zone_17.geojson 15 'tms' \u003e\u003e tile_indices.txt\n```\n\n## Additional details\nGeoDex is optimized to use very little RAM (compared to our previous tool, [`cover.js`](https://github.com/developmentseed/skynet-train/blob/master/cover.js)). It uses a depth-first search algorithm that continually returns tile indices instead of storing all tiles in memory at once (see toy example below). This ensures that the program won't crash due to memory overflow as full tile lists can grow to a few gigabytes. The total runtime generally depends on the number of tiles (determined by boundary size and zoom level) as well as the roughness of the boundary.\n\nTile indexing is built on top of [pyGeoTile](https://github.com/geometalab/pyGeoTile).\n\n### Toy example\n\u003cimg src=\"./depth_search_toy_example.gif\" width=\"450\" /\u003e\n\n### Scripting with GeoDex\nThe command line functionality is mostly insulated from the core code. Therefore, you can incorporate this algorithm into a script by catching `sys.stdout` as follows:\n```\nimport subprocess\nfrom ast import literal_eval\n\n# Run geojson through GeoDex, get tiles\nstd_result = subprocess.run(['geodex', '/Users/wronk/Builds/looking-glass/preds/bounds/hcmc-simple.geojson', str(15), '--output-format', '({z}, {x}, {y})'], stdout=subprocess.PIPE)\n\n# Convert from bytes to string, then to tuples\ntile_inds_string = std_result.stdout.decode('utf-8').split('\\n')\ntile_inds_tuple = [literal_eval(ti) for ti in tile_inds_string if len(ti) \u003e 0]\n```\n\nGeoDex was developed during a [project to map high-voltage electricity lines](https://www.devseed.com/ml-grid-docs/) that was supported by the [World Bank](http://www.worldbank.org/).\n\n## See also\n\nGeoDex has some overlapping functionality with [mercantile](http://mercantile.readthedocs.io/en/latest/index.html) as both can get all indices within a bounding region. If your geojson specifies a single rectangle, Mercantile can be faster. However, GeoDex will also properly handle geojsons specifying an arbitrary (non-rectangular) polygon or multiple polygons within the same geojson. Additionally, GeoDex uses [pyGeoTile](https://github.com/geometalab/pyGeoTile) to obtain tile indices for specific bounding regions, so it has some added features like the ability to request all three handle three major tile formats (Google, TMS, and QuadTree).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Fgeodex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopmentseed%2Fgeodex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Fgeodex/lists"}