do not expire tiles for nodes within limitto_cache_buffer
parent
353bc5d974
commit
10847c43c4
|
@ -23,3 +23,14 @@ func ExpireProjectedNodes(expireor Expireor, nodes []element.Node, srid int, clo
|
||||||
panic("unsupported srid")
|
panic("unsupported srid")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExpireProjectedNode(expireor Expireor, node element.Node, srid int) {
|
||||||
|
if srid == 4326 {
|
||||||
|
expireor.Expire(node.Long, node.Lat)
|
||||||
|
} else if srid == 3857 {
|
||||||
|
long, lat := proj.MercToWgs(node.Long, node.Lat)
|
||||||
|
expireor.Expire(long, lat)
|
||||||
|
} else {
|
||||||
|
panic("unsupported srid")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/omniscale/imposm3/cache"
|
"github.com/omniscale/imposm3/cache"
|
||||||
"github.com/omniscale/imposm3/database"
|
"github.com/omniscale/imposm3/database"
|
||||||
"github.com/omniscale/imposm3/element"
|
"github.com/omniscale/imposm3/element"
|
||||||
|
"github.com/omniscale/imposm3/expire"
|
||||||
geomp "github.com/omniscale/imposm3/geom"
|
geomp "github.com/omniscale/imposm3/geom"
|
||||||
"github.com/omniscale/imposm3/geom/geos"
|
"github.com/omniscale/imposm3/geom/geos"
|
||||||
"github.com/omniscale/imposm3/mapping"
|
"github.com/omniscale/imposm3/mapping"
|
||||||
|
@ -49,9 +50,6 @@ func (nw *NodeWriter) loop() {
|
||||||
for n := range nw.nodes {
|
for n := range nw.nodes {
|
||||||
nw.progress.AddNodes(1)
|
nw.progress.AddNodes(1)
|
||||||
if matches := nw.pointMatcher.MatchNode(n); len(matches) > 0 {
|
if matches := nw.pointMatcher.MatchNode(n); len(matches) > 0 {
|
||||||
if nw.expireor != nil {
|
|
||||||
nw.expireor.Expire(n.Long, n.Lat)
|
|
||||||
}
|
|
||||||
nw.NodeToSrid(n)
|
nw.NodeToSrid(n)
|
||||||
point, err := geomp.Point(geos, *n)
|
point, err := geomp.Point(geos, *n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -67,6 +65,7 @@ func (nw *NodeWriter) loop() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inserted := false
|
||||||
if nw.limiter != nil {
|
if nw.limiter != nil {
|
||||||
parts, err := nw.limiter.Clip(geom.Geom)
|
parts, err := nw.limiter.Clip(geom.Geom)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -78,14 +77,19 @@ func (nw *NodeWriter) loop() {
|
||||||
log.Warn(err)
|
log.Warn(err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
inserted = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := nw.inserter.InsertPoint(n.OSMElem, geom, matches); err != nil {
|
if err := nw.inserter.InsertPoint(n.OSMElem, geom, matches); err != nil {
|
||||||
log.Warn(err)
|
log.Warn(err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
inserted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if inserted && nw.expireor != nil {
|
||||||
|
expire.ExpireProjectedNode(nw.expireor, *n, nw.srid)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nw.wg.Done()
|
nw.wg.Done()
|
||||||
|
|
Loading…
Reference in New Issue