locode: Use quadtree to find continent #830
1 changed files with 2 additions and 3 deletions
|
@ -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"
|
||||
fyrchik marked this conversation as resolved
Outdated
|
||||
"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
|
||||
achuprov
commented
Is there a way to simplify this code? Is there a way to simplify this code?
https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/cff78d77c22b788a398a958a9a9d1f02b43b6148/pkg/util/locode/db/continents/geojson/calls.go#L94-L110
Nesterfifa
commented
Reduced the nesting depth to 2 Reduced the nesting depth to 2
|
||||
|
||||
fyrchik marked this conversation as resolved
fyrchik
commented
What about What about `var multiPolygon orb.MultiPolygon`? `make(_, 0)` is usually never needed: `nil` acts good enough as the default value.
Nesterfifa
commented
Fixed Fixed
|
||||
if polygon, ok := feature.Geometry.(orb.Polygon); ok {
|
||||
multiPolygon = append(multiPolygon, polygon)
|
||||
|
|
Loading…
Reference in a new issue
Please, attach all non-stdlib imports in a single group (see
paulmach/orb
below).Fixed