locode: Use quadtree to find continent #830

Closed
Nesterfifa wants to merge 6 commits from Nesterfifa/frostfs-node:782-use-quadtree into master
Showing only changes of commit 6999993fd2 - Show all commits

View file

@ -4,12 +4,11 @@ import (
"fmt"
"os"
"github.com/paulmach/orb/quadtree"
locodedb "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/locode/db"
"github.com/paulmach/orb"
"github.com/paulmach/orb/geojson"
"github.com/paulmach/orb/planar"
"github.com/paulmach/orb/quadtree"
)
const continentProperty = "Continent"
@ -92,7 +91,7 @@ func (db *DB) buildQuadtree() error {
})
for _, feature := range db.features {
multiPolygon := make(orb.MultiPolygon, 0)
var multiPolygon orb.MultiPolygon
fyrchik marked this conversation as resolved
Review

What about var multiPolygon orb.MultiPolygon? make(_, 0) is usually never needed: nil acts good enough as the default value.

What about `var multiPolygon orb.MultiPolygon`? `make(_, 0)` is usually never needed: `nil` acts good enough as the default value.
Review

Fixed

Fixed
if polygon, ok := feature.Geometry.(orb.Polygon); ok {
multiPolygon = append(multiPolygon, polygon)