Skip to content

Commit

Permalink
Fix nearby markers for new algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
MzHub committed Jan 27, 2018
1 parent 7792cb3 commit e1da4d6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions osmcoverer.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ func main() {
containedMarkers, containedHoleMarkers, nearbyMarkers := checkContainedMarkerFeatures(covering, holeCovering, *maxLevel, isHole, feature, markers)

if *checkCellCenters {
containedMarkers = checkContainedCellCenters(polygons, isHole, feature, containedMarkers)
containedHoleMarkers = checkContainedCellCenters(holePolygons, true, feature, containedHoleMarkers)
containedMarkers, nearbyMarkers = checkContainedCellCenters(polygons, isHole, feature, containedMarkers, nearbyMarkers)
containedHoleMarkers, nearbyMarkers = checkContainedCellCenters(holePolygons, true, feature, containedHoleMarkers, nearbyMarkers)
}

if *outputSeparateFiles {
Expand Down Expand Up @@ -418,7 +418,7 @@ func checkContainedMarkerFeatures(
}


func checkContainedCellCenters(polygons []*s2.Polygon, isHole bool, coveringFeature *geojson.Feature, markers []Marker) []Marker {
func checkContainedCellCenters(polygons []*s2.Polygon, isHole bool, coveringFeature *geojson.Feature, markers []Marker, nearbyMarkers []Marker) ([]Marker, []Marker) {
containedMarkers := []Marker{}
for _, marker := range markers {
isWithin := false
Expand All @@ -436,9 +436,11 @@ func checkContainedCellCenters(polygons []*s2.Polygon, isHole bool, coveringFeat
}
if isWithin {
containedMarkers = append(containedMarkers, marker)
} else {
nearbyMarkers = append(nearbyMarkers, marker)
}
}
return containedMarkers
return containedMarkers, nearbyMarkers
}


Expand Down

0 comments on commit e1da4d6

Please sign in to comment.