1
0
forked from MTSR/mapserver
This commit is contained in:
Thomas Rudin 2019-01-21 20:13:38 +01:00
parent 49df4712fd
commit ed352fed60
4 changed files with 25 additions and 7 deletions

View File

@ -1,10 +1,11 @@
package initialrenderer
import (
"github.com/sirupsen/logrus"
"mapserver/app"
"mapserver/coords"
"time"
"github.com/sirupsen/logrus"
)
func Job(ctx *app.App) {
@ -45,6 +46,15 @@ func Job(ctx *app.App) {
for tc.Zoom > 1 {
tc = tc.GetZoomedOutTile()
fields = logrus.Fields{
"X": tc.X,
"Y": tc.Y,
"Zoom": tc.Zoom,
"LayerId": tc.LayerId,
}
logrus.WithFields(fields).Trace("Removing tile")
ctx.Objectdb.RemoveTile(tc)
}
}

View File

@ -72,7 +72,7 @@ func (a *MapBlockAccessor) FindLegacyMapBlocks(lastpos coords.MapBlockCoords, li
"y": block.Pos.Y,
"z": block.Pos.Z,
}
logrus.WithFields(fields).Debug("legacy mapblock")
logrus.WithFields(fields).Trace("legacy mapblock")
key := getKey(block.Pos)
@ -120,7 +120,7 @@ func (a *MapBlockAccessor) FindLatestMapBlocks(mintime int64, limit int, layerfi
"y": block.Pos.Y,
"z": block.Pos.Z,
}
logrus.WithFields(fields).Debug("updated mapblock")
logrus.WithFields(fields).Trace("updated mapblock")
key := getKey(block.Pos)

View File

@ -97,6 +97,7 @@ func (tr *TileRenderer) RenderImage(tc *coords.TileCoords, cachedOnly bool) (*im
}
if cachedOnly {
log.WithFields(logrus.Fields{"x": tc.X, "y": tc.Y, "zoom": tc.Zoom}).Debug("Skip image")
return nil, nil
}
@ -132,6 +133,14 @@ func (tr *TileRenderer) RenderImage(tc *coords.TileCoords, cachedOnly bool) (*im
recursiveCachedOnly := tc.Zoom < 12
fields := logrus.Fields{
"UpperLeft": quads.UpperLeft,
"UpperRight": quads.UpperRight,
"LowerLeft": quads.LowerLeft,
"LowerRight": quads.LowerRight,
}
log.WithFields(fields).Debug("Quad image stats")
upperLeft, err := tr.RenderImage(quads.UpperLeft, recursiveCachedOnly)
if err != nil {
return nil, err
@ -184,9 +193,7 @@ func (tr *TileRenderer) RenderImage(tc *coords.TileCoords, cachedOnly bool) (*im
}
buf := new(bytes.Buffer)
if img != nil {
png.Encode(buf, img)
}
png.Encode(buf, img)
tile := mapobjectdb.Tile{Pos: tc, Data: buf.Bytes(), Mtime: time.Now().Unix()}
tr.tdb.SetTile(&tile)

View File

@ -2,7 +2,6 @@ package tilerenderer
import (
"bytes"
"github.com/sirupsen/logrus"
"io/ioutil"
"mapserver/colormapping"
"mapserver/coords"
@ -14,6 +13,8 @@ import (
"mapserver/testutils"
"os"
"testing"
"github.com/sirupsen/logrus"
)
func TestTileRender(t *testing.T) {