{"id":50501941,"url":"https://github.com/worldbank/geometadatatools","last_synced_at":"2026-06-02T12:30:46.378Z","repository":{"id":356123010,"uuid":"1081445570","full_name":"worldbank/geometadatatools","owner":"worldbank","description":"Lightweight tools to extract, analyze, and visualize metadata from raster and vector geospatial datasets","archived":false,"fork":false,"pushed_at":"2025-12-04T20:31:20.000Z","size":927,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-06T19:19:42.213Z","etag":null,"topics":["geospatial","gis","metadata","metadata-extractor","raster","vector-graphics"],"latest_commit_sha":null,"homepage":"https://worldbank.github.io/metadata-editor-docs/quick_start_geographic.html","language":"Jupyter Notebook","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/worldbank.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-22T19:46:30.000Z","updated_at":"2026-02-17T06:39:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/worldbank/geometadatatools","commit_stats":null,"previous_names":["worldbank/geometadatatools"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/worldbank/geometadatatools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fgeometadatatools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fgeometadatatools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fgeometadatatools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fgeometadatatools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/worldbank","download_url":"https://codeload.github.com/worldbank/geometadatatools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldbank%2Fgeometadatatools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33822812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["geospatial","gis","metadata","metadata-extractor","raster","vector-graphics"],"created_at":"2026-06-02T12:30:45.344Z","updated_at":"2026-06-02T12:30:46.373Z","avatar_url":"https://github.com/worldbank.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GeoMetadataTools\n\nGeoMetadataTools is a Python library designed to extract, analyze, and visualize metadata from geospatial datasets. It supports both raster and vector formats, providing enriched metadata, bounding box calculations, and thumbnail quality visualizations.\n\n## Installation\n\nTo install GeoMetadataTools, use pip:\n\n```bash\npip install geometadatatools\n```\n\n## Supported Formats\n\n- **Vector**: GeoJSON, Shapefile (SHP), KML, GPKG, GDB\n- **Raster**: NetCDF (NC), TIF, BIL, ASCII (XYZ), GeoPDF (PDF), JPG, GIF, ADF, OVR\n\nWe do not support zipped files directly; please unzip them before use. That includes KMZ which is the zipped version of KML.\n\n\n## Importing the Library\n\n```python\nfrom geometadatatools import get_file_info, read_and_enrich, total_bounding_box_in_wgs84, get_images, get_data\n```\n\n## Examples\n\n### Vector Data Example: GeoJSON File\n\n```python\n# Inspect the file\nfile_info = get_file_info(\"tests/sample_files/city_of_york_allotments.geojson\")\nprint(file_info[\"file\"])  # Basic file metadata\nprint(file_info[\"layers\"])  # List of layer names\nprint(file_info[\"type\"])  # GeoJSON is a 'vector' type file\n\n# Calculate the total bounding box\nbbox = total_bounding_box_in_wgs84(\"tests/sample_files/city_of_york_allotments.geojson\")\nprint(bbox)\n\n# Enrich the file\ninfo = read_and_enrich(\"tests/sample_files/city_of_york_allotments.geojson\",layer_name_or_band_index=\"Allotments\")\nprint(info['crs'])  # Coordinate Reference System used in the file\nprint(info['analytics']['layer'])  # Layer bounding box, geohash, and number of features\nprint(info['analytics']['feature_types'])  # Feature types present in the layer for example {'id': int, 'geom': 'geometry'}\nprint(info[\"analytics\"][\"feature_statistics\"])  # Statistics for each feature attribute\n\nimg_strings = get_images(\"tests/sample_files/city_of_york_allotments.geojson\")  # List of base64-encoded images, one per layer\n```\n\n### Raster Data Example: TIF File\n\n```python\n# Inspect the file\nfile_info = get_file_info(\"tests/sample_files/small_tiff_sample.tif\")\nprint(file_info[\"file\"])  # Basic file metadata\nprint(file_info[\"raster_stats\"])  # File level statistics specific to raster files - the number of rows and columns of pixels\nprint(file_info[\"layers\"])  # List of band names\nprint(file_info[\"type\"])  # TIF is a 'raster' type file\n\n# Calculate the total bounding box\nbbox = total_bounding_box_in_wgs84(\"tests/sample_files/small_tiff_sample.tif\")\nprint(bbox)\n\n# Enrich the file\ninfo = read_and_enrich(\"tests/sample_files/small_tiff_sample.tif\",layer_name_or_band_index=1)\nprint(info['projection'])  # Raster files have projections rather than CRS\nprint(info[\"analytics\"][\"feature_statistics\"])  # Statistics for the raster band such as min, max, mean, stddev, null value and units. Note thare raster files do not have 'features' like vector files do so there is no other layer or feature analytics.\n\nimg_strings = get_images(\"tests/sample_files/small_tiff_sample.tif\")  # List of base64-encoded images, one per band\n```\n\n\n## Key Functions\n\n### `get_file_info`\n\nExtracts metadata from a file, including file size, type, layers, and raster statistics (if applicable).\n\n### `read_and_enrich`\n\nReads a specific layer or band from the file and enriches it with detailed metadata and analytics.\n\n### `total_bounding_box_in_wgs84`\n\nCalculates the total bounding box of the file in WGS84 projection.\n\n### `get_images`\nGenerates visualizations of the data as base64-encoded images. There is one image per layer or band.\n\n### `get_data`\nExtracts the actual data from a specified layer or band in a structured format (for a vector file this is a geopandas GeoDataFrame, for a raster file this is a GDAL Dataset).\n\n## Possible directions for future development\n- Extract Z information\n- Alternative colour schemes for images\n\n## Contributing and Testing\n\nThe repository includes tests to ensure the functionality of the library. If you want to contribute, be sure to run unit and integration tests before creating a PR. To get set up we use UV for managing dependencies and virtual environments. After cloning the repository, run the following commands to set up the development environment and run the tests:\n\n```bash\nuv venv \u0026\u0026 uv sync --dev\nuv run pytest tests/\n```\n\nImportantly, these tests are set up to download sample files when run, ensuring that the repository remains lightweight. The files and their sources are documented in `tests/file_manifest.yaml`. \n\nThe first time you run the tests, the necessary files will be downloaded automatically. Note that a shape file is included directly in the repo. This library is designed to work with shape files but not with zipped files which is the most common way shape files are shared. So an unzipped shape file is included for testing purposes.\n\nAdditional testing, for example on proprietary datasets, can be performed by placing files in the `tests/sample_files` directory. If these files are proprietary, be careful not to commit them to the repository.\n\nIf there are any changes to the dependencies, update the THIRD_PARTY_LICENSES.md file by running:\n\n```bash\nuv run pip-licenses --format=markdown --with-license-file \\    \n  | sed \"s|$HOME|~|g\" \\\n  | sed \"s|$(pwd)||g\" \\\n  \u003e THIRD_PARTY_LICENSES.md\n```\n\nJust listing the third party licenses by name may not be sufficient for compliance with some open source licenses so ensure that the THIRD_PARTY_LICENSES.md file is kept up to date.\n\nTo get a list of third party licenses without the full license text, run:\n\n```bash\nuv run pip-licenses --format=markdown\n```\n\n## Acknowledgments\n\nParts of this repository were written with assistance from Large Language Models (LLMs).\n\nMany thanks to the team at INEGI for useful feedback on the early versions of this library. \n\n## Third Party licenses\n\nThird-party libraries used by this project, and listed in pyproject.toml or uv.lock, have their licenses listed in THIRD_PARTY_LICENSES.md\n\n## License\n\nThis project is licensed under the MIT License together with the [World Bank IGO Rider](WB-IGO-RIDER.md). The Rider is purely procedural: it reserves all privileges and immunities enjoyed by the World Bank, without adding restrictions to the MIT permissions. Please review both files before using, distributing or contributing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldbank%2Fgeometadatatools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworldbank%2Fgeometadatatools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldbank%2Fgeometadatatools/lists"}