Skip to content

Commit

Permalink
Merge branch 'amatissart-fix-wayId-in-cache'
Browse files Browse the repository at this point in the history
  • Loading branch information
olt committed Aug 23, 2022
2 parents 20db391 + d827090 commit 33e15ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions test/single_table.osc
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
<tag k="building" v="office"/>
</relation>
</modify>

<modify>
<node id="20002" version="2" timestamp="2011-11-11T00:11:11Z" lat="43" lon="13"/>
</modify>

</osmChange>
5 changes: 5 additions & 0 deletions test/single_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func TestSingleTable(t *testing.T) {
ts.assertHstore(t, []checkElem{
{"osm_all", -20201, "*", map[string]string{"random": "tag", "highway": "yes"}},
})
ts.assertGeomLength(t, checkElem{"osm_all", -20201, "*", nil}, 111319.5)
})

t.Run("NonMappedClosedWayIsMissing", func(t *testing.T) {
Expand Down Expand Up @@ -209,6 +210,10 @@ func TestSingleTable(t *testing.T) {
}
})

t.Run("ModifiedWayGeometryAfterNodeMoved", func(t *testing.T) {
ts.assertGeomLength(t, checkElem{"osm_all", -20201, "*", nil}, 222639)
})

t.Run("Cleanup", func(t *testing.T) {
ts.dropSchemas()
if err := os.RemoveAll(ts.dir); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions writer/ways.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ func (ww *WayWriter) loop() {
return true
}

w.ID = ww.wayID(w.ID)

var err error
inserted := false
insertedPolygon := false
Expand Down Expand Up @@ -140,6 +138,7 @@ func (ww *WayWriter) buildAndInsert(

// make copy to avoid interference with polygon/linestring matches
way := osm.Way(*w)
way.ID = ww.wayID(way.ID)

var err error
var geosgeom *geos.Geom
Expand Down Expand Up @@ -172,7 +171,6 @@ func (ww *WayWriter) buildAndInsert(
inserted = false
}
for _, p := range parts {
way := osm.Way(*w)
geom = geomp.Geometry{Geom: p, Wkb: g.AsEwkbHex(p)}
if isPolygon {
if err := ww.inserter.InsertPolygon(way.Element, geom, matches); err != nil {
Expand Down

0 comments on commit 33e15ac

Please sign in to comment.