https://github.com/aaronland/go-http-mbtiles
Go HTTP handler for serving MBTiles databases.
https://github.com/aaronland/go-http-mbtiles
golang http maps mbtiles
Last synced: 12 months ago
JSON representation
Go HTTP handler for serving MBTiles databases.
- Host: GitHub
- URL: https://github.com/aaronland/go-http-mbtiles
- Owner: aaronland
- Created: 2020-10-21T16:20:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-22T16:47:40.000Z (over 5 years ago)
- Last Synced: 2025-02-09T09:17:58.925Z (12 months ago)
- Topics: golang, http, maps, mbtiles
- Language: Go
- Homepage:
- Size: 2.24 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-http-mbtiles
Go HTTP handler for serving MBTiles databases.
## Example
```
package main
import (
"github.com/aaronland/go-http-mbtiles"
"net/http"
"regexp"
)
func main() {
tiles_source := "/path/to/folder/containing/mbtiles/"
tiles_pattern := `/tiles/([a-z-]+)/(\d+)/(\d+)/(\d+)\.([a-z]+)$`
tiles_extension := ".db"
tiles_path := "/tiles"
tiles_re, _ := regexp.Compile(tiles_pattern)
tiles_opts := &mbtiles.MBTilesHandlerOptions{
Root: tiles_source,
Extension: tiles_extension,
Pattern: tiles_re,
}
tiles_handler, _ := mbtiles.MBTilesHandler(tiles_opts)
mux := http.NewServeMux()
mux.Handle(tiles_path, tiles_handler)
// serve mux here
}
```
_Error handling omitted for brevity._
## See also
* https://github.com/mattn/go-sqlite3
* https://github.com/aaronland/go-mbtiles-server