protomaps / go-pmtiles

Single-file executable tool for working with PMTiles archives
BSD 3-Clause "New" or "Revised" License
350 stars 48 forks source link

Intergration as a library #166

Closed DmitriyVTitov closed 3 months ago

DmitriyVTitov commented 3 months ago

I want to integrate go-pmtiles into my project as a library instead of using complete app as a server. I'd like to be able to import Go package with HTTP handler that could serve tiles. Do you have such plans to implement separate library for PMTiles?

thisisaaronland commented 3 months ago

It is possible to a new PMTile server instance using pmtiles.NewServer and then pass that instance to your HTTP handler to serve tiles. For example:

bdon commented 3 months ago

Another example: https://github.com/protomaps/go-pmtiles/blob/main/caddy/pmtiles_proxy.go#L49

DmitriyVTitov commented 3 months ago

@thisisaaronland @bdon Thanks!