Concepts
Tilegroxy has a few important concepts that are important to understand to utilize it effectively.
Operators and Users
Tilegroxy distinguishes between two sources of input:
-
The Operator (probably you) writes the configuration. It’s trusted, much like code. Tilegroxy prevents foot-guns but makes no attempt to stop deliberately harmful configuration.
-
The User makes tile requests. Anything on a request, including the layer name, pattern placeholder values, coordinates, headers, query string, and tokens, is treated as potentially hostile.
Keep this in mind whenever configuration passes something from a request into a provider, such as placeholder values in a URL or SQL query. Restrict placeholders with paramValidator as tightly as you can. See Security for the full set of considerations.
Layers
A layer is a map layer a client can request tiles from. Everything else in the configuration exists to serve layers. Each layer has an id, optionally a pattern with placeholders, and a provider that produces its tiles.
Clients request tiles by layer name, which is matched against each layer’s pattern (or its id when there’s no pattern). Layers are checked in the order they appear in your configuration and the first match wins. Values captured by placeholders can be checked with paramValidator and used by some providers.
Caches
A cache stores generated tiles so the provider doesn’t have to run again. If you don’t configure one, nothing is cached.
The top-level cache can be a single cache or a list of them. The first one in the list is the default for every layer unless you set defaultcache to the ID of another. A layer can pick a different cache with its own cache parameter or opt out entirely with skipcache.
Datastores
Datastores are shared connections, mostly to databases, defined once with an ID. Providers, caches, and analytics refer to them by that ID, usually through a datastore parameter. This avoids opening a separate connection pool, or other resources, for every entity that needs one.
Authentication
Authentication defines rules to restrict incoming tile requests. Beyond pure authentication, some schemes (JWT and custom) can provide basic authorization checks by restricting to certain layers or a geographic area.
See User Dynamic Layers if your tiles vary by user.
Custom
Several of the entities described above have a special type available called "Custom." This Custom provider/authentication/analytics allows the operator to write their own code to implement the entity without needing to recompile tilegroxy, making it much easier to handle trickier, non-standard map layers, or to customize how tilegroxy fits into a broader application. Custom always translates to a Yaegi interpreted Go script that has to follow a specific interface. Full details are in Extensibility