Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion processing/processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,11 @@ func (p *GeometryProcessor) ProcessSingle(geometry geom.Geometry) map[tms20.TMID
geomsAndTilesPerTileMatrix := make(map[tms20.TMID]SnapResult, len(p.tmIDs))
for _, tmsID := range p.tmIDs {
newGeometries := newGeometriesPerTileMatrix[tmsID]
tiles := p.detectTiles(ix, tmsID, newGeometries)
singleGeometry := geomhelp.GeometrySliceToGeom(newGeometries)
if singleGeometry == nil {
continue
}
tiles := p.detectTiles(ix, tmsID, newGeometries)
geomsAndTilesPerTileMatrix[tmsID] = SnapResult{singleGeometry, tiles}
}
return geomsAndTilesPerTileMatrix
Expand Down
12 changes: 11 additions & 1 deletion processing/processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,22 @@ func TestProcessSingle(t *testing.T) {
2: {Geometry: geom.MultiPolygon{polyA, polyB}, Tiles: []tile.Tile{tileA, tileB}},
},
},
{
name: "nil geometry leaves unset results",
tmIDs: []tms20.TMID{1},
config: Config{EncodeTiles: true, UseLineTrace: false},
snapOutput: map[tms20.TMID][]geom.Geometry{
1: {},
},
detectTilesResult: map[tms20.TMID][]tile.Tile{},
want: map[tms20.TMID]SnapResult{},
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// This counts how often "tileDetect" has been called
numDetect := len(tt.tmIDs)
numDetect := len(tt.want)

processor := NewGeometryProcessor(tt.tmIDs, tt.config, createMockSnapFunc(tt.snapOutput), createMockIndexFactory(&numDetect, tt.insertErr, tt.detectTilesResult))

Expand Down
Loading