maptiles

package
v1.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package maptiles validates browser basemap configuration.

Index

Constants

View Source
const (
	// DefaultURL is the OpenStreetMap Standard raster tile endpoint.
	DefaultURL = "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
	// DefaultAttribution is the attribution required for OpenStreetMap tiles.
	DefaultAttribution = `&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL         string
	Attribution string
}

Config contains the URL template and visible attribution for a basemap.

func Default

func Default() Config

Default returns the validated OpenStreetMap tile configuration.

func New

func New(rawURL, attribution string) (Config, error)

New validates a tile URL template and its attribution. Empty values select the OpenStreetMap defaults. A custom URL requires custom attribution.

func (Config) CSPSource

func (c Config) CSPSource() string

CSPSource returns the absolute tile origin for a Content Security Policy. A root-relative URL returns an empty source because 'self' already permits it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL