tilegroxy Docs

Description

func transform(r, g, b, a uint8) (uint8, uint8, uint8, uint8)

You can include the logic in a dedicated file, or inline in configuration. No special types or functions are available for use besides the standard library. A package declaration and any imports are optional.

This can only be used with layers that return JPEG or PNG images. The result is always output in PNG format at the same size as the tile from the downstream provider.

Example

  • YAML

  • JSON

provider:
  name: transform
  threads: 8
  formula: |
    func transform(r, g, b, a uint8) (uint8, uint8, uint8, uint8) {
      return g,b,r,a
    }
  provider:
    name: proxy
    url: https://tile.openstreetmap.org/{z}/{x}/{y}.png
{
  "provider": {
    "name": "transform",
    "threads": 8,
    "formula": "func transform(r, g, b, a uint8) (uint8, uint8, uint8, uint8) {\n  return g,b,r,a\n}\n",
    "provider": {
      "name": "proxy",
      "url": "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
    }
  }
}

Configuration

Configuration options
Parameter Description Type Required Default

file

An absolute file path to find the Go code implementing the transformation

string

No

None

formula

The go code implementing the transformation. Required if file isn’t included

string

No

None

provider

The provider to get the imagery to transform

Provider

Yes

None

threads

How many threads (goroutines) to use per tile. The typical tile has 65,536 pixels, setting this to 8 for instance means each thread has to process 8,192 pixels in parallel. This helps avoid latency becoming problematically slow.

int

No

1