Skip to content

ESRIC: Add write (CreateCopy()) support#14362

Open
HusamMohammad wants to merge 34 commits into
OSGeo:masterfrom
HusamMohammad:esric_writer
Open

ESRIC: Add write (CreateCopy()) support#14362
HusamMohammad wants to merge 34 commits into
OSGeo:masterfrom
HusamMohammad:esric_writer

Conversation

@HusamMohammad
Copy link
Copy Markdown

@HusamMohammad HusamMohammad commented Apr 14, 2026

What does this PR do?

Added write support for the ESRIC driver through the CreateCopy() pattern. The writer only supports writing the zipped .tpkx cache with JSON metadata, not the exploded directory cache characterized by the XML metadata conf.xml.

What are related issues/pull requests?

N/A

AI tool usage

  • AI (Claude Code) supported my development of this PR. See our policy about AI tool use. Use of AI tools must be indicated.

Tasklist

  • Make sure code is correctly formatted (cf pre-commit configuration)
  • Add test case(s)
  • Add documentation
  • Updated Python API documentation (swig/include/python/docs/)
  • Review
  • Adjust for comments
  • All CI builds and checks have passed

Environment

Provide environment details, if relevant:

  • OS: Windows 11
  • Compiler: MSVC 14.44 (Visual Studio 2022 Professional)

Build a warped VRT for each LOD, encode non-empty tiles, and write them into the matching bundle writer for each bundle block
… 1 band sources to RGB before resampling.

Expand paletted 1-band sources to RGB(A) so that resampling operates on colour values instead of palette indices
Each output LOD now warps from the coarsest source overview that does not exceed the target resolution, avoiding unnecessary downsampling from full
  resolution. Uses nearest-neighbour resampling when resolutions match
Quality is applicable for JPEG only and has a default of 75. MIN_LOD  and MAX_LOD must be in the range [0, 23] and the default is 0 and 1 to match arcgis pro. Summary is a string and Tags are user comma separated tags
ArcGIS sets RGB(253, 253, 253) as the NoData for JPEG and RGBA(NoData, NoData, NoData, 0) for PNG
Since disabling deflate compression to match arcgis pro, need to also disable SOZIP
…mplicit conversions between variables and set the default TILE_FORMAT to PNG to match ArcGIS Pro
@rouault rouault added the AI assisted⚠️ AI assisted coding involved. Review with extreme scepticism. label Apr 14, 2026
@rouault
Copy link
Copy Markdown
Member

rouault commented Apr 14, 2026

CC @lucianpls
I'm personnally on diet related to AI based contributions

@HusamMohammad
Copy link
Copy Markdown
Author

Hi @lucianpls , any update on this?

@lucianpls
Copy link
Copy Markdown
Contributor

@HusamMohammad

Hi,

To be honest, I don't see the need for this. Adding write for only TPKX format would be very confusing. Even if regular cache could be made writable, I don't really want to have to answer questions or maintain that kind of code in gdal.

The esri tile cache format is supposed to be a mostly read format that scales to really large sizes since the individual pieces can be worked on independently while being large enough to be more efficient that single tiles. The TPKX is only a transfer mechanism for a cache, which has problems when it gets large enough.
I added the standard cache reading because it was easy, not much code, and there is imagery in this format. TPKX reading was added later, being just a slight change of the metadata and organization, skipping the "unzip" part and dealing with the JSON vs XML metadata differences. The bundled cache format itself is somewhat flexible within esri, not telling where it will go next.

I prefer a separate toolchain, having the capability to create individual bundles and pack later, it would be higher performance, more useful and flexible. Similar to the gdal2tiles script. Pieces exist, like my own MaBaker that creates bundles using gdal python bindings. Adding a python "tpkx" python packer to that would be easy, if having TPKX is the ultimate goal.

@lucianpls
Copy link
Copy Markdown
Contributor

I believe that esri has no intention of supporting tpkx as a generic raster format either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted⚠️ AI assisted coding involved. Review with extreme scepticism.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants