Fixes #14. mtseeder and mtwebmapper now have command line flags -ymin=block and -ymax=block to limit the y range of mapping. Defaults to full range.

This commit is contained in:
Sascha L. Teichmann
2015-07-27 19:03:47 +02:00
parent 464ccbf670
commit e606e2700f
6 changed files with 66 additions and 28 deletions

View File

@ -35,16 +35,9 @@ func createTiles(
}
}
func order(a, b int) (int, int) {
if a < b {
return a, b
}
return b, a
}
func createBaseLevel(
address string,
xMin, zMin, xMax, zMax int,
xMin, yMin, zMin, xMax, yMax, zMax int,
transparent bool, transparentDim float32,
colorsFile, outDir string,
numWorkers int) (err error) {
@ -71,11 +64,14 @@ func createBaseLevel(
return
}
done.Add(1)
btc := common.NewBaseTileCreator(client, colors, transparent, baseDir, false)
btc := common.NewBaseTileCreator(
client, colors,
int16(yMin), int16(yMax),
transparent, baseDir, false)
go createTiles(btc, jobs, &done)
}
zMin, zMax = order(zMin, zMax)
zMin, zMax = common.Order(zMin, zMax)
for x, i := int16(xMin), 0; x <= int16(xMax); x += 16 {
xDir := filepath.Join(baseDir, strconv.Itoa(i))

View File

@ -14,18 +14,18 @@ import (
func main() {
var (
port int
host string
xMin, zMin int
xMax, zMax int
colorsFile string
outDir string
numWorkers int
skipBaseLevel bool
skipPyramid bool
transparent bool
transparentDim float64
version bool
port int
host string
xMin, yMin, zMin int
xMax, yMax, zMax int
colorsFile string
outDir string
numWorkers int
skipBaseLevel bool
skipPyramid bool
transparent bool
transparentDim float64
version bool
)
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
@ -33,6 +33,8 @@ func main() {
flag.StringVar(&host, "host", "localhost", "host to mtredisalize server")
flag.IntVar(&xMin, "xmin", -1933, "x min of the area to tile")
flag.IntVar(&xMax, "xmax", 1932, "x max of the area to tile")
flag.IntVar(&yMin, "ymin", common.MinHeight, "Minimum y in blocks.")
flag.IntVar(&yMax, "ymax", common.MaxHeight, "Maximum y in blocks.")
flag.IntVar(&zMin, "zmin", -1933, "z min of the area to tile")
flag.IntVar(&zMax, "zmax", 1932, "z max of the area to tile")
flag.StringVar(&colorsFile, "colors", "colors.txt", "definition of colors")
@ -65,7 +67,7 @@ func main() {
address := fmt.Sprintf("%s:%d", host, port)
if err := createBaseLevel(
address,
xMin, zMin, xMax, zMax,
xMin, yMin, zMin, xMax, yMax, zMax,
transparent, td,
colorsFile,
outDir,