Example #1
0
func latLon() (minC, maxC *gopnik.TileCoord) {
	if *latMin != 0.0 && *lonMin != 0.0 && *latMax != 0.0 && *lonMax != 0.0 {
		c1 := gproj.FromLLToCoord(*latMin, *lonMin, *zoom)
		c2 := gproj.FromLLToCoord(*latMax, *lonMax, *zoom)
		maxC = &c1
		minC = &c2
		if maxC.X < minC.X {
			maxC.X, minC.X = minC.X, maxC.X
		}
		if maxC.Y < minC.Y {
			maxC.Y, minC.Y = minC.Y, maxC.Y
		}
	}
	return
}
Example #2
0
func genCoords(bbox [4]float64, zoom uint64) (res []gopnik.TileCoord, err error) {
	minC := gproj.FromLLToCoord(bbox[0], bbox[2], zoom)
	maxC := gproj.FromLLToCoord(bbox[1], bbox[3], zoom)
	metaSize := app.App.Metatiler().MetaSize(zoom)
	mask := metaSize - 1
	minX, maxX := minMaxUint64(minC.X & ^mask, maxC.X & ^mask)
	minY, maxY := minMaxUint64(minC.Y & ^mask, maxC.Y & ^mask)
	for x := minX; x <= maxX; x += metaSize {
		for y := minY; y <= maxY; y += metaSize {
			res = append(res, gopnik.TileCoord{
				X:    x,
				Y:    y,
				Zoom: zoom,
				Size: metaSize,
			})
		}
	}
	return
}
Example #3
0
func convertCoordByZoom(coord gopnik.TileCoord, zoom uint64) gopnik.TileCoord {
	lat, lon, _ := gproj.FromCoordToLL(coord)
	return gproj.FromLLToCoord(lat, lon, zoom)
}