Documentation ¶
Index ¶
- Constants
- func BlankPNG(tilesize uint32) []byte
- func RelativePathID(filename, baseDir string) (string, error)
- func SHA1ID(filename string) string
- type HandlerWrapper
- type IDGenerator
- type ServiceInfo
- type ServiceSet
- func (s *ServiceSet) AddTileset(filename, id string) error
- func (s *ServiceSet) Handler() http.Handler
- func (s *ServiceSet) HasTileset(id string) bool
- func (s *ServiceSet) IDFromURLPath(id string) string
- func (s *ServiceSet) LockTileset(id string)
- func (s *ServiceSet) RemoveTileset(id string) error
- func (s *ServiceSet) Size() int
- func (s *ServiceSet) UnlockTileset(id string)
- func (s *ServiceSet) UpdateTileset(id string) error
- type ServiceSetConfig
- type Tileset
Constants ¶
const ArcGISInfoRoot = ArcGISRoot + "info"
const ArcGISRoot = "/arcgis/rest/"
const ArcGISServicesRoot = ArcGISRoot + "services/"
Variables ¶
This section is empty.
Functions ¶
func BlankPNG ¶
BlankPNG returns bytes of a blank PNG of the requested size, falling back to 256px if a suitable size is not available. Used for the request handlers to return when an image tile is not available. Images created with https://png-pixel.com/ then minified using tinypng.com
func RelativePathID ¶
RelativePathID returns a relative path from the basedir to the filename.
Types ¶
type HandlerWrapper ¶
HandlerWrapper is a type definition for a function that takes an http.Handler and returns an http.Handler
func HMACAuthMiddleware ¶
func HMACAuthMiddleware(secretKey string, serviceSet *ServiceSet) HandlerWrapper
HMACAuthMiddleware wraps incoming requests to enforce HMAC signature authorization. All requests are expected to have either "signature" and "date" query parameters or "X-Signature" and "X-Signature-Date" headers.
type IDGenerator ¶
type ServiceInfo ¶
type ServiceInfo struct { ImageType string `json:"imageType"` URL string `json:"url"` Name string `json:"name"` }
ServiceInfo provides basic information about the service.
type ServiceSet ¶
type ServiceSet struct {
// contains filtered or unexported fields
}
ServiceSet is a group of tilesets plus configuration options. It provides access to all tilesets from a root URL.
func New ¶
func New(cfg *ServiceSetConfig) (*ServiceSet, error)
New returns a new ServiceSet. If no ServiceSetConfig is provided, the service is initialized with default values of ServiceSetConfig.
func (*ServiceSet) AddTileset ¶
func (s *ServiceSet) AddTileset(filename, id string) error
AddTileset adds a single tileset identified by idGenerator using the filename. If a service already exists with that ID, an error is returned.
func (*ServiceSet) Handler ¶
func (s *ServiceSet) Handler() http.Handler
Handler returns a http.Handler that serves the endpoints of the ServiceSet. The function ef is called with any occurring error if it is non-nil, so it can be used for e.g. logging with logging facilities of the caller.
func (*ServiceSet) HasTileset ¶
func (s *ServiceSet) HasTileset(id string) bool
HasTileset returns true if the tileset identified by id exists within this ServiceSet.
func (*ServiceSet) IDFromURLPath ¶
func (s *ServiceSet) IDFromURLPath(id string) string
IDFromURLPath extracts a tileset ID from a URL Path. If no valid ID is found, a blank string is returned.
func (*ServiceSet) LockTileset ¶
func (s *ServiceSet) LockTileset(id string)
LockTileset sets a write mutex on the tileset to block reads while this tileset is being updated. This is ignored if the tileset does not exist.
func (*ServiceSet) RemoveTileset ¶
func (s *ServiceSet) RemoveTileset(id string) error
RemoveTileset removes the Tileset and closes the associated mbtiles file identified by id, if it already exists. If it does not exist, this returns without error. Any errors encountered removing the Tileset are returned.
func (*ServiceSet) Size ¶
func (s *ServiceSet) Size() int
Size returns the number of tilesets in this ServiceSet
func (*ServiceSet) UnlockTileset ¶
func (s *ServiceSet) UnlockTileset(id string)
UnlockTileset removes the write mutex on the tileset. This is ignored if the tileset does not exist.
func (*ServiceSet) UpdateTileset ¶
func (s *ServiceSet) UpdateTileset(id string) error
UpdateTileset reloads the Tileset identified by id, if it already exists. Otherwise, this returns an error. Any errors encountered updating the Tileset are returned.
type ServiceSetConfig ¶
type ServiceSetConfig struct { EnableServiceList bool EnableTileJSON bool EnablePreview bool EnableArcGIS bool RootURL *url.URL ErrorWriter io.Writer }
ServiceSetConfig provides configuration options for a ServiceSet