From 3ac986a4986437683c19b92a638ce32e976eca35 Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Fri, 17 Nov 2017 14:18:12 +0100 Subject: [PATCH] code: remove unused functions/conversions --- cache/diff.go | 6 ------ database/postgis/columns.go | 8 -------- expire/tilelist.go | 6 ------ geom/geojson/geojson.go | 10 ---------- mapping/columns.go | 12 ------------ mapping/mapping.go | 4 ++-- parser/pbf/pbf.go | 8 -------- 7 files changed, 2 insertions(+), 52 deletions(-) diff --git a/cache/diff.go b/cache/diff.go index 128e260..63c9156 100644 --- a/cache/diff.go +++ b/cache/diff.go @@ -14,12 +14,6 @@ import ( "github.com/omniscale/imposm3/element" ) -type byInt64 []int64 - -func (a byInt64) Len() int { return len(a) } -func (a byInt64) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byInt64) Less(i, j int) bool { return a[i] < a[j] } - type DiffCache struct { Dir string Coords *CoordsRefIndex // Stores which ways a coord references diff --git a/database/postgis/columns.go b/database/postgis/columns.go index 9383661..7fef617 100644 --- a/database/postgis/columns.go +++ b/database/postgis/columns.go @@ -27,14 +27,6 @@ func (t *simpleColumnType) GeneralizeSql(colSpec *ColumnSpec, spec *GeneralizedT return "\"" + colSpec.Name + "\"" } -type hstoreColumnType struct { - simpleColumnType -} - -func (t *hstoreColumnType) PrepareInsertSql(i int, spec *TableSpec) string { - return fmt.Sprintf("$%d::hstore", i) -} - type geometryType struct { name string } diff --git a/expire/tilelist.go b/expire/tilelist.go index 6229f51..e461a2f 100644 --- a/expire/tilelist.go +++ b/expire/tilelist.go @@ -54,12 +54,6 @@ type tileKey struct { Y uint32 } -type tile struct { - x uint32 - y uint32 - z uint32 -} - func NewTileList(zoom int, out string) *TileList { return &TileList{ tiles: make(map[tileKey]struct{}), diff --git a/geom/geojson/geojson.go b/geom/geojson/geojson.go index cefdc98..b48f235 100644 --- a/geom/geojson/geojson.go +++ b/geom/geojson/geojson.go @@ -19,11 +19,6 @@ type object struct { Properties map[string]interface{} `json:"properties"` } -type geometry struct { - Type string `json:"type"` - Coordinates []interface{} `json:"coordinates"` -} - type Point struct { Long float64 Lat float64 @@ -72,11 +67,6 @@ func newLineStringFromCoords(coords []interface{}) (LineString, error) { type Polygon []LineString -type polygonFeature struct { - polygon Polygon - properties map[string]string -} - type Feature struct { Polygon Polygon Properties map[string]string diff --git a/mapping/columns.go b/mapping/columns.go index e4def11..41705a4 100644 --- a/mapping/columns.go +++ b/mapping/columns.go @@ -409,15 +409,3 @@ func MakeSuffixReplace(columnName string, columnType ColumnType, column config.C return suffixReplace, nil } - -func asHex(b []byte) string { - digits := "0123456789ABCDEF" - buf := make([]byte, 0, len(b)*2) - n := len(b) - - for i := 0; i < n; i++ { - c := b[i] - buf = append(buf, digits[c>>4], digits[c&0xF]) - } - return string(buf) -} diff --git a/mapping/mapping.go b/mapping/mapping.go index 0bbff53..f17029d 100644 --- a/mapping/mapping.go +++ b/mapping/mapping.go @@ -366,14 +366,14 @@ func (m *Mapping) addFilters(filters tableElementFilters) { log.Print("warn: exclude_tags filter is deprecated and will be removed. See require and reject filter.") for _, filterKeyVal := range *t.Filters.ExcludeTags { // Convert `exclude_tags`` filter to `reject` filter ! - keyname := string(filterKeyVal[0]) + keyname := filterKeyVal[0] vararr := []config.OrderedValue{ { Value: config.Value(filterKeyVal[1]), Order: 1, }, } - filters[name] = append(filters[name], makeFiltersFunction(name, false, true, string(keyname), vararr)) + filters[name] = append(filters[name], makeFiltersFunction(name, false, true, keyname, vararr)) } } diff --git a/parser/pbf/pbf.go b/parser/pbf/pbf.go index c73e8a6..cd5d3b8 100644 --- a/parser/pbf/pbf.go +++ b/parser/pbf/pbf.go @@ -7,14 +7,6 @@ import ( const coord_factor float64 = 11930464.7083 // ((2<<31)-1)/360.0 -func coordToInt(coord float64) uint32 { - return uint32((coord + 180.0) * coord_factor) -} - -func intToCoord(coord uint32) float64 { - return float64((float64(coord) / coord_factor) - 180.0) -} - func readDenseNodes( dense *osmpbf.DenseNodes, block *osmpbf.PrimitiveBlock,