maps

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: BSD-3-Clause Imports: 8 Imported by: 3

README

go-http-maps

Go package providing opinionated HTTP middleware for web-based map tiles.

Important

This is work in progress. Documentation is incomplete.

Until then have a look at cmd/server/main.go, templates/html/map.html and static/javascript/aaronland.map.init.js for an example of working code.

Example

go run -mod vendor cmd/server/main.go \
	-map-provider tangramjs \
	-tilezen-enable-tilepack \
	-tilezen-tilepack-path /usr/local/data/sf.db

See also

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendAssetHandlers

func AppendAssetHandlers(mux *gohttp.ServeMux) error

Append all the files in the net/http FS instance containing the embedded Maps assets to an *http.ServeMux instance.

func AppendAssetHandlersWithPrefix

func AppendAssetHandlersWithPrefix(mux *gohttp.ServeMux, prefix string) error

Append all the files in the net/http FS instance containing the embedded Maps assets to an *http.ServeMux instance ensuring that all URLs are prepended with prefix.

func AppendResourcesHandler

func AppendResourcesHandler(next gohttp.Handler, opts *MapsOptions) gohttp.Handler

AppendResourcesHandler will rewrite any HTML produced by previous handler to include the necessary markup to load Maps JavaScript and CSS files and related assets.

func AppendResourcesHandlerWithPrefix

func AppendResourcesHandlerWithPrefix(next gohttp.Handler, opts *MapsOptions, prefix string) gohttp.Handler

AppendResourcesHandlerWithPrefix will rewrite any HTML produced by previous handler to include the necessary markup to load Maps JavaScript files and related assets ensuring that all URIs are prepended with a prefix.

func AssetsHandler

func AssetsHandler() (gohttp.Handler, error)

AssetsHandler returns a net/http FS instance containing the embedded Maps assets that are included with this package.

func AssetsHandlerWithPrefix

func AssetsHandlerWithPrefix(prefix string) (gohttp.Handler, error)

AssetsHandler returns a net/http FS instance containing the embedded Maps assets that are included with this package ensuring that all URLs are stripped of prefix.

Types

type MapsOptions

type MapsOptions struct {
	JS  []string
	CSS []string
}

MapsOptions provides a list of JavaScript and CSS link to include with HTML output.

func DefaultMapsOptions

func DefaultMapsOptions() *MapsOptions

Return a *MapsOptions struct with default paths and URIs.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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