allways call Expire with wgs84 coords
parent
02e2abfd2a
commit
bba7d68380
|
@ -7,7 +7,6 @@ import (
|
||||||
"github.com/omniscale/imposm3/element"
|
"github.com/omniscale/imposm3/element"
|
||||||
"github.com/omniscale/imposm3/expire"
|
"github.com/omniscale/imposm3/expire"
|
||||||
"github.com/omniscale/imposm3/mapping"
|
"github.com/omniscale/imposm3/mapping"
|
||||||
"github.com/omniscale/imposm3/proj"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Deleter struct {
|
type Deleter struct {
|
||||||
|
@ -134,8 +133,7 @@ func (d *Deleter) deleteRelation(id int64, deleteRefs bool, deleteMembers bool)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
proj.NodesToMerc(m.Way.Nodes)
|
expire.ExpireNodes(d.expireor, m.Way.Nodes, 4326)
|
||||||
expire.ExpireNodes(d.expireor, m.Way.Nodes)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -179,7 +177,7 @@ func (d *Deleter) deleteWay(id int64, deleteRefs bool) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
expire.ExpireNodes(d.expireor, elem.Nodes)
|
expire.ExpireNodes(d.expireor, elem.Nodes, 4326)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,23 @@ package expire
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/omniscale/imposm3/element"
|
"github.com/omniscale/imposm3/element"
|
||||||
|
"github.com/omniscale/imposm3/proj"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Expireor interface {
|
type Expireor interface {
|
||||||
Expire(long, lat float64)
|
Expire(long, lat float64)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExpireNodes(expireor Expireor, nodes []element.Node) {
|
func ExpireNodes(expireor Expireor, nodes []element.Node, srid int) {
|
||||||
for _, nd := range nodes {
|
if srid == 4326 {
|
||||||
expireor.Expire(nd.Long, nd.Lat)
|
for _, nd := range nodes {
|
||||||
|
expireor.Expire(nd.Long, nd.Lat)
|
||||||
|
}
|
||||||
|
} else if srid == 4326 {
|
||||||
|
for _, nd := range nodes {
|
||||||
|
expireor.Expire(proj.MercToWgs(nd.Long, nd.Lat))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
panic("unsupported srid")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,10 +49,10 @@ 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 {
|
||||||
nw.NodeToSrid(n)
|
|
||||||
if nw.expireor != nil {
|
if nw.expireor != nil {
|
||||||
nw.expireor.Expire(n.Long, n.Lat)
|
nw.expireor.Expire(n.Long, n.Lat)
|
||||||
}
|
}
|
||||||
|
nw.NodeToSrid(n)
|
||||||
point, err := geomp.Point(geos, *n)
|
point, err := geomp.Point(geos, *n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errl, ok := err.(ErrorLevel); !ok || errl.Level() > 0 {
|
if errl, ok := err.(ErrorLevel); !ok || errl.Level() > 0 {
|
||||||
|
|
|
@ -125,7 +125,7 @@ NextRel:
|
||||||
if inserted && rw.expireor != nil {
|
if inserted && rw.expireor != nil {
|
||||||
for _, m := range allMembers {
|
for _, m := range allMembers {
|
||||||
if m.Way != nil {
|
if m.Way != nil {
|
||||||
expire.ExpireNodes(rw.expireor, m.Way.Nodes)
|
expire.ExpireNodes(rw.expireor, m.Way.Nodes, rw.srid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ func (ww *WayWriter) loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if inserted && ww.expireor != nil {
|
if inserted && ww.expireor != nil {
|
||||||
expire.ExpireNodes(ww.expireor, w.Nodes)
|
expire.ExpireNodes(ww.expireor, w.Nodes, ww.srid)
|
||||||
}
|
}
|
||||||
if ww.diffCache != nil {
|
if ww.diffCache != nil {
|
||||||
ww.diffCache.Coords.AddFromWay(w)
|
ww.diffCache.Coords.AddFromWay(w)
|
||||||
|
|
Loading…
Reference in New Issue