Exemplo n.º 1
0
func (tsi *TilesetIndex) readTileset(path string) (ts *mbtiles.Tileset) {
	ts, err := mbtiles.ReadTileset(path)
	if err != nil {
		warn(err, "skipping "+path)
		return
	}
	name := cleanTilesetName(path)
	if _, exists := tsi.Tilesets[name]; exists {
		check(fmt.Errorf("Multiple tilesets with slug %q like %q", name, path))
	}
	return
}
Exemplo n.º 2
0
func InitTiles(mbtpath string, upsert bool, desc string, extent int) (t Tileset, err error) {
	tiles.TileSize = extent
	var ts *mbtiles.Tileset
	if upsert {
		ts, err = mbtiles.ReadTileset(mbtpath)
	} else {
		attrs := map[string]string{
			"name":        util.SlugBase(mbtpath),
			"type":        "overlay",
			"version":     "1",
			"description": desc,
			"format":      "pbf.gz",
		}
		ts, err = mbtiles.InitTileset(mbtpath, attrs)
	}
	if err != nil {
		return
	}
	t = Tileset{tileset: ts}
	return
}