{"id":13735484,"url":"https://github.com/mapbox/COGDumper","last_synced_at":"2025-05-08T11:33:24.974Z","repository":{"id":52844477,"uuid":"125431504","full_name":"mapbox/COGDumper","owner":"mapbox","description":"Dumps tiles out of a cloud optimized geotiff","archived":false,"fork":false,"pushed_at":"2021-09-15T18:02:02.000Z","size":39,"stargazers_count":61,"open_issues_count":2,"forks_count":13,"subscribers_count":93,"default_branch":"master","last_synced_at":"2024-04-08T01:02:38.623Z","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/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-15T22:07:33.000Z","updated_at":"2024-03-05T22:42:00.000Z","dependencies_parsed_at":"2022-08-23T08:41:20.103Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/COGDumper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FCOGDumper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FCOGDumper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FCOGDumper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2FCOGDumper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/COGDumper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224727181,"owners_count":17359532,"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":"2024-08-03T03:01:07.342Z","updated_at":"2024-11-15T03:31:58.684Z","avatar_url":"https://github.com/mapbox.png","language":"Python","funding_links":[],"categories":["`Python` processing of optical imagery (non deep learning)"],"sub_categories":["Cloud Native Geospatial"],"readme":"# COG Dumper\n\n[![Build Status](https://travis-ci.org/mapbox/COGDumper.svg?branch=master)](https://travis-ci.org/mapbox/COGDumper) [![codecov](https://codecov.io/gh/mapbox/COGDumper/branch/master/graph/badge.svg?token=Yd3y5aTvGo)](https://codecov.io/gh/mapbox/COGDumper)\n\nA python (3.6) utility to extract a tile from a Cloud Optimized GeoTIFF (COG) without decompressing the contained data. Tiff data can be hosted locally, on a web server or S3.\n\nThis can be useful for serving compressed tiles from a TIFF without invoking Rasterio and GDAL. This utility has been tested with Tiff that have JPEG compression.\n\nTiled Tiff is an extension to TIFF 6.0 and more detail can be found [here](http://www.alternatiff.com/resources/TIFFphotoshop.pdf)\n\nNote that tiles are padded at the edge of an image. This requires an image [mask](https://trac.osgeo.org/gdal/wiki/rfc15_nodatabitmask) to be defined if tile sizes do not align with the image width / height (as in the test data which demonstrates this effect).\n\n\n## Data Preparation\n\nRead the document on [COG](https://trac.osgeo.org/gdal/wiki/CloudOptimizedGeoTIFF) and create a tiled pyramid GeoTIFF.\n\nFor example;\n\n```\ngdal_translate SENTINEL2_L1C:S2A_MSIL1C_20170102T111442_N0204_R137_T30TXT_20170102T111441.SAFE/MTD_MSIL1C.xml:TCI:EPSG_32630 \\\n               S2A_MSIL1C_20170102T111442_N0204_R137_T30TXT_20170102T111441_TCI.tif \\\n               -co TILED=YES -co COMPRESS=DEFLATE\ngdaladdo -r average  S2A_MSIL1C_20170102T111442_N0204_R137_T30TXT_20170102T111441_TCI.tif 2 4 8 16 32\ngdal_translate S2A_MSIL1C_20170102T111442_N0204_R137_T30TXT_20170102T111441_TCI.tif \\\n               S2A_MSIL1C_20170102T111442_N0204_R137_T30TXT_20170102T111441_TCI_cloudoptimized_2.tif \\\n               -co TILED=YES -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -co COPY_SRC_OVERVIEWS=YES\n```\n\nThis library also works with a file hosted in an S3 bucket.\n\n## Installation\n\nPython 3.6 is required.\n\n```\npip install cogdumper\n```\n\nor from source\n\n```\ngit clone https://github.com/mapbox/COGDumper\ncd COGDumper\npip install .\n```\n\n## Command line interface\n\n```\n$ cogdumper --help\nUsage: cogdumper [OPTIONS] COMMAND [ARGS]...\n\n  Command line interface for COGDumper.\n\nOptions:\n  --version  Show the version and exit.\n  --help     Show this message and exit.\n\nCommands:\n  file  COGDumper cli for local dataset.\n  http  COGDumper cli for web hosted dataset.\n  s3    COGDumper cli for AWS S3 hosted dataset\n```\n\n##### local files\n```\ncogdumper file --help\nUsage: cogdumper file [OPTIONS]\n\n  COGDumper cli for local dataset.\n\nOptions:\n  --file PATH       input file  [required]\n  --output PATH     local output directory\n  --xyz INTEGER...  xyz tile coordinate where z is the overview level\n  --version         Show the version and exit.\n  --help            Show this message and exit.\n```\ne.g. `cogdumper file --file data/cog.tif --xyz 0 0 0`\n\n##### web files\n\n```\ncogdumper http --help\nUsage: cogdumper http [OPTIONS]\n\n  COGDumper cli for web hosted dataset.\n\nOptions:\n  --server TEXT       server e.g. http://localhost:8080  [required]\n  --path TEXT         server path\n  --resource TEXT     server resource\n  --output DIRECTORY  local output directory\n  --xyz INTEGER...    xyz tile coordinates where z is the overview level\n  --version           Show the version and exit.\n  --help              Show this message and exit.\n```\n\ne.g. `cogdumper http --server http://localhost:8080 --path data --resource cog.tif`\n\n##### S3 files\n```\ncogdumper s3 --help\nUsage: cogdumper s3 [OPTIONS]\n\n  COGDumper cli for AWS S3 hosted dataset\n\nOptions:\n  --bucket TEXT       AWS S3 bucket  [required]\n  --key TEXT          AWS S3 key  [required]\n  --output DIRECTORY  local output directory\n  --xyz INTEGER...    xyz tile coordinates where z is the overview level\n  --help              Show this message and exit.\n```\n\ne.g. `cogdumper s3 --bucket bucket_name --key key_name/image.tif --xyz 0 0 0`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2FCOGDumper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2FCOGDumper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2FCOGDumper/lists"}