1

I want to reduce the size of the cache memory that GeoWebCache makes. The cache is in PNG8 format, but the request from the client is in PNG format (FORMAT=image%2Fpng) and I can't change it. How do I configure GeoWebCache to save PNG8 with the .png extension? I can rename all files (tile.png8 -> tile.png), but perhaps there is a correct solution to my problem?

request

http://192.168.0.163:8080/geoserver/gwc/service/wms?STYLES=&VERSION=1.3.0&SRS=EPSG%3A3857&TRANSPARENT=TRUE&LAYERS=cite%3AALLGroup&EXCEPTIONS=INIMAGE&SERVICE=WMS&REQUEST=GetMap&FORMAT=image%2Fpng&CRS=EPSG%3A900913&BBOX=5290665.3462613,7817367.7529044,5293111.3311661,7819813.7378091&WIDTH=256&HEIGHT=256

I want to store the cache in png format like google map.

Driver: PNG/Portable Network Graphics
Files: 3.png
Size is 128, 128
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  128.0)
Upper Right (  128.0,    0.0)
Lower Right (  128.0,  128.0)
Center      (   64.0,   64.0)
Band 1 Block=128x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 84,88,72,255
    1: 76,88,72,255
    2: 80,88,72,255
    3: 72,84,68,255
    4: 76,84,68,255
    5: 84,92,76,255
    6: 88,96,80,255
    7: 68,80,64,255
    8: 155,159,139,255
    9: 80,92,76,255
   10: 88,92,76,255
   11: 84,96,80,255
   12: 92,100,84,255
   13: 88,96,76,255
   14: 116,120,100,255
   15: 92,104,88,255
   16: 100,112,96,255
   17: 100,104,84,255
   18: 64,76,60,255
   19: 96,104,88,255
   20: 167,171,151,255
   21: 187,187,175,255
   22: 68,84,68,255
   23: 72,80,64,255
   24: 84,92,72,255
   25: 68,84,64,255
   26: 104,108,88,255
   27: 100,108,92,255
   28: 147,151,131,255
   29: 92,96,80,255
   30: 88,88,72,255
   31: 171,175,155,255
   32: 80,84,68,255
   33: 199,195,179,255
   34: 72,88,68,255
   35: 92,100,80,255
   36: 76,92,72,255
   37: 108,116,100,255
   38: 104,112,96,255
   39: 96,100,80,255
   40: 179,179,167,255
   41: 112,116,96,255
   42: 163,167,147,255
   43: 112,120,104,255
   44: 108,112,92,255
   45: 96,108,92,255
   46: 76,88,68,255
   47: 143,147,135,255
   48: 80,88,68,255
   49: 92,92,76,255
   50: 96,104,84,255
   51: 116,124,108,255
   52: 72,88,72,255
   53: 88,100,84,255
   54: 108,120,104,255
   55: 96,108,88,255
   56: 120,120,100,255
   57: 104,104,88,255
   58: 120,124,104,255
   59: 76,80,64,255
   60: 64,80,64,255
   61: 100,104,88,255
   62: 207,207,187,255
   63: 100,112,92,255
   64: 131,131,112,255
   65: 135,135,116,255
   66: 147,151,135,255
   67: 131,135,116,255
   68: 96,100,84,255
   69: 80,92,72,255
   70: 143,143,131,255
   71: 112,116,100,255
   72: 88,92,72,255
   73: 120,131,116,255
   74: 131,135,112,255
   75: 139,139,120,255
   76: 56,72,52,255
   77: 179,179,159,255
   78: 68,76,60,255
   79: 96,96,80,255
   80: 116,120,104,255
   81: 96,108,96,255
   82: 76,92,76,255
   83: 104,112,92,255
   84: 104,116,100,255
   85: 108,108,92,255
   86: 124,131,116,255
   87: 48,64,56,255
   88: 128,131,112,255
   89: 100,108,88,255
   90: 100,100,84,255
   91: 112,124,108,255
   92: 92,96,76,255
   93: 76,84,64,255
   94: 72,84,64,255
   95: 88,100,80,255
   96: 116,116,100,255
   97: 84,96,76,255
   98: 64,84,64,255
   99: 124,124,108,255
  100: 84,88,68,255
  101: 60,72,56,255
  102: 108,116,96,255
  103: 120,120,104,255
  104: 108,112,96,255
  105: 112,112,92,255
  106: 116,116,96,255
  107: 108,108,88,255
  108: 147,147,124,255
  109: 72,84,72,255
  110: 116,128,112,255
  111: 84,84,68,255
  112: 84,100,84,255
  113: 88,92,80,255
  114: 124,135,120,255
  115: 112,112,96,255
  116: 60,76,56,255
  117: 76,88,76,255
  118: 135,139,116,255
  119: 104,104,84,255
  120: 128,128,108,255
  121: 120,128,112,255
  122: 72,76,60,255
  123: 159,163,147,255
  124: 124,128,108,255
  125: 139,147,131,255
  126: 64,80,60,255
  127: 147,155,139,255
  128: 139,143,124,255
  129: 139,143,120,255
  130: 128,131,116,255
  131: 88,100,88,255
  132: 135,143,128,255
  133: 128,131,108,255
  134: 80,96,80,255
  135: 116,124,104,255
  136: 104,108,92,255
  137: 92,104,84,255
  138: 131,131,116,255
  139: 128,139,124,255
  140: 100,100,80,255
  141: 68,80,68,255
  142: 76,84,72,255
  143: 151,155,135,255
  144: 120,124,108,255
  145: 84,100,80,255
  146: 76,80,68,255
  147: 143,147,131,255
  148: 108,112,100,255
  149: 131,139,120,255
  150: 151,151,135,255
  151: 143,143,124,255
  152: 68,88,68,255
  153: 120,124,100,255
  154: 135,139,120,255
  155: 60,80,60,255
  156: 124,124,112,255
  157: 120,128,108,255
  158: 151,155,139,255
  159: 215,215,195,255
  160: 124,131,112,255
  161: 135,139,124,255
  162: 80,84,64,255
  163: 72,92,72,255
  164: 112,124,104,255
  165: 80,96,76,255
  166: 80,92,80,255
  167: 155,163,147,255
  168: 155,155,135,255
  169: 80,84,72,255
  170: 84,88,76,255
  171: 135,139,128,255
  172: 159,163,143,255
  173: 68,80,60,255
  174: 112,120,100,255
  175: 151,151,139,255
  176: 92,96,84,255
  177: 131,135,124,255
  178: 131,135,120,255
  179: 64,76,64,255
  180: 124,135,116,255
  181: 143,143,120,255
  182: 96,100,88,255
  183: 116,120,96,255
  184: 124,128,104,255
  185: 96,96,76,255
  186: 104,116,96,255
  187: 120,120,108,255
  188: 68,72,56,255
  189: 223,219,207,255
  190: 40,56,40,255
  191: 143,147,128,255
  192: 108,120,100,255
  193: 163,163,139,255
  194: 64,72,56,255
  195: 92,104,80,255
  196: 108,112,88,255
  197: 135,135,120,255
  198: 84,84,72,255
  199: 139,139,124,255
  200: 92,100,76,255
  201: 139,143,131,255
  202: 92,92,72,255
  203: 143,147,124,255
  204: 72,76,64,255
  205: 159,159,151,255
  206: 124,128,112,255
  207: 96,104,80,255
  208: 112,116,92,255
  209: 80,80,64,255
  210: 139,139,131,255
  211: 124,131,108,255
  212: 116,128,108,255
  213: 120,124,112,255
  214: 72,80,68,255
  215: 88,100,76,255
  216: 131,131,108,255
  217: 76,96,76,255
  218: 84,92,80,255
  219: 100,104,80,255
  220: 108,120,112,255
  221: 80,88,76,255
  222: 239,239,223,255
  223: 227,231,211,255
  224: 135,135,124,255
  225: 84,92,68,255
  226: 135,143,131,255
  227: 28,52,40,255
  228: 100,108,84,255
  229: 128,124,104,255
  230: 155,155,131,255
  231: 139,147,124,255
  232: 131,131,124,255
  233: 48,76,68,255
  234: 84,96,72,255
  235: 112,120,96,255
  236: 68,76,64,255
  237: 128,135,116,255
  238: 80,92,68,255
  239: 80,80,60,255
  240: 72,80,60,255
  241: 100,116,100,255
  242: 28,60,52,255
  243: 76,88,64,255
  244: 72,92,76,255
  245: 131,139,116,255
  246: 88,92,68,255
  247: 20,40,32,255
  248: 84,88,64,255
  249: 139,143,128,255
  250: 92,96,72,255
  251: 128,135,120,255
  252: 80,88,64,255
  253: 12,44,36,255
  254: 24,52,44,255
  255: 16,48,44,255
4
  • 1
    I fear there is nothing that you can do on the GeoServer and GWC side but having an option to save png8 as .png feels like a reasonable configuration option. Right now I think that rewriting the requests that come into TomCat or Jetty would be be quite a good solution.
    – user30184
    Commented Feb 12, 2020 at 9:57
  • the problem with changing the endings is that image/png and image/png8 are different formats and the client should respect that. I'd file a bug against the client
    – Ian Turton
    Commented Feb 12, 2020 at 13:04
  • @Ian Turton I agree, but how do I store a PNG cache with an 8-bit color depth?
    – 4gexotron
    Commented Feb 12, 2020 at 14:06
  • You would need to write some new code. Or maybe run rgb2pct.py on them though in my test the size goes from 62k to 1.3M when I do that
    – Ian Turton
    Commented Feb 12, 2020 at 14:48

1 Answer 1

0

Thanks. Then I will try to create a PNG cache with a color depth of 24 bits, and then convert the files to 8 bits using gdal tools, leaving the png extension.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.