Skip to content

Commit

Permalink
Merge pull request #1 from dhduvall/latlon
Browse files Browse the repository at this point in the history
Latitude and longitude are reversed
  • Loading branch information
evanoberholster authored Sep 26, 2019
2 parents 4a3a5b7 + 1163a7d commit 5804073
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 67 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ func main() {
}

res, err := tz.Query(timezone.Coord{
Lon: 5.261417, Lat: -3.925778,})
Lat: 5.261417, Lon: -3.925778,})
if err != nil {
fmt.Println(err)
}
fmt.Println("Query Result: ", res)

tz.Close()
}
```
```
120 changes: 60 additions & 60 deletions cmd/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,66 +18,66 @@ func main() {
}

querys := []timezone.Coord{
{Lon: 5.261417, Lat: -3.925778,}, // Abijan Airport
{Lon: -15.678889,Lat: 34.973889,}, // Blantyre Airport
{Lon: -12.65945, Lat: 18.25674,},
{Lon: 41.8976, Lat:-87.6205},
{Lon: 47.6897, Lat: -122.4023},
{Lon: 42.7235, Lat:-73.6931},
{Lon: 42.5807, Lat:-83.0223},
{Lon: 36.8381, Lat:-84.8500},
{Lon: 40.1674, Lat:-85.3583},
{Lon: 37.9643, Lat:-86.7453},
{Lon: 38.6043, Lat:-90.2417},
{Lon: 41.1591, Lat:-104.8261},
{Lon: 35.1991, Lat:-111.6348},
{Lon: 43.1432, Lat:-115.6750},
{Lon: 47.5886, Lat:-122.3382},
{Lon: 58.3168, Lat:-134.4397},
{Lon: 21.4381, Lat:-158.0493},
{Lon: 42.7000, Lat:-80.0000},
{Lon: 51.0036, Lat:-114.0161},
{Lon:-16.4965, Lat:-68.1702},
{Lon:-31.9369, Lat:115.8453},
{Lon: 42.0000, Lat:-87.5000},
{Lon: 41.8976, Lat:-87.6205},
{Lon: 47.6897, Lat: -122.4023},
{Lon: 42.7235, Lat:-73.6931},
{Lon: 42.5807, Lat:-83.0223},
{Lon: 36.8381, Lat:-84.8500},
{Lon: 40.1674, Lat:-85.3583},
{Lon: 37.9643, Lat:-86.7453},
{Lon: 38.6043, Lat:-90.2417},
{Lon: 41.1591, Lat:-104.8261},
{Lon: 35.1991, Lat:-111.6348},
{Lon: 43.1432, Lat:-115.6750},
{Lon: 47.5886, Lat:-122.3382},
{Lon: 58.3168, Lat:-134.4397},
{Lon: 21.4381, Lat:-158.0493},
{Lon: 42.7000, Lat:-80.0000},
{Lon: 51.0036, Lat:-114.0161},
{Lon:-16.4965, Lat:-68.1702},
{Lon:-31.9369, Lat:115.8453},
{Lon: 42.0000, Lat:-87.5000},
{Lon: 41.8976, Lat:-87.6205},
{Lon: 47.6897, Lat: -122.4023},
{Lon: 42.7235, Lat:-73.6931},
{Lon: 42.5807, Lat:-83.0223},
{Lon: 36.8381, Lat:-84.8500},
{Lon: 40.1674, Lat:-85.3583},
{Lon: 37.9643, Lat:-86.7453},
{Lon: 38.6043, Lat:-90.2417},
{Lon: 41.1591, Lat:-104.8261},
{Lon: 35.1991, Lat:-111.6348},
{Lon: 43.1432, Lat:-115.6750},
{Lon: 47.5886, Lat:-122.3382},
{Lon: 58.3168, Lat:-134.4397},
{Lon: 21.4381, Lat:-158.0493},
{Lon: 42.7000, Lat:-80.0000},
{Lon: 51.0036, Lat:-114.0161},
{Lon:-16.4965, Lat:-68.1702},
{Lon:-31.9369, Lat:115.8453},
{Lon: 42.0000, Lat:-87.5000},
{Lat: 5.261417, Lon: -3.925778,}, // Abijan Airport
{Lat: -15.678889,Lon: 34.973889,}, // Blantyre Airport
{Lat: -12.65945, Lon: 18.25674,},
{Lat: 41.8976, Lon:-87.6205},
{Lat: 47.6897, Lon: -122.4023},
{Lat: 42.7235, Lon:-73.6931},
{Lat: 42.5807, Lon:-83.0223},
{Lat: 36.8381, Lon:-84.8500},
{Lat: 40.1674, Lon:-85.3583},
{Lat: 37.9643, Lon:-86.7453},
{Lat: 38.6043, Lon:-90.2417},
{Lat: 41.1591, Lon:-104.8261},
{Lat: 35.1991, Lon:-111.6348},
{Lat: 43.1432, Lon:-115.6750},
{Lat: 47.5886, Lon:-122.3382},
{Lat: 58.3168, Lon:-134.4397},
{Lat: 21.4381, Lon:-158.0493},
{Lat: 42.7000, Lon:-80.0000},
{Lat: 51.0036, Lon:-114.0161},
{Lat:-16.4965, Lon:-68.1702},
{Lat:-31.9369, Lon:115.8453},
{Lat: 42.0000, Lon:-87.5000},
{Lat: 41.8976, Lon:-87.6205},
{Lat: 47.6897, Lon: -122.4023},
{Lat: 42.7235, Lon:-73.6931},
{Lat: 42.5807, Lon:-83.0223},
{Lat: 36.8381, Lon:-84.8500},
{Lat: 40.1674, Lon:-85.3583},
{Lat: 37.9643, Lon:-86.7453},
{Lat: 38.6043, Lon:-90.2417},
{Lat: 41.1591, Lon:-104.8261},
{Lat: 35.1991, Lon:-111.6348},
{Lat: 43.1432, Lon:-115.6750},
{Lat: 47.5886, Lon:-122.3382},
{Lat: 58.3168, Lon:-134.4397},
{Lat: 21.4381, Lon:-158.0493},
{Lat: 42.7000, Lon:-80.0000},
{Lat: 51.0036, Lon:-114.0161},
{Lat:-16.4965, Lon:-68.1702},
{Lat:-31.9369, Lon:115.8453},
{Lat: 42.0000, Lon:-87.5000},
{Lat: 41.8976, Lon:-87.6205},
{Lat: 47.6897, Lon: -122.4023},
{Lat: 42.7235, Lon:-73.6931},
{Lat: 42.5807, Lon:-83.0223},
{Lat: 36.8381, Lon:-84.8500},
{Lat: 40.1674, Lon:-85.3583},
{Lat: 37.9643, Lon:-86.7453},
{Lat: 38.6043, Lon:-90.2417},
{Lat: 41.1591, Lon:-104.8261},
{Lat: 35.1991, Lon:-111.6348},
{Lat: 43.1432, Lon:-115.6750},
{Lat: 47.5886, Lon:-122.3382},
{Lat: 58.3168, Lon:-134.4397},
{Lat: 21.4381, Lon:-158.0493},
{Lat: 42.7000, Lon:-80.0000},
{Lat: 51.0036, Lon:-114.0161},
{Lat:-16.4965, Lon:-68.1702},
{Lat:-31.9369, Lon:115.8453},
{Lat: 42.0000, Lon:-87.5000},
}

var times []int64
Expand Down
2 changes: 1 addition & 1 deletion cmd/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func main() {
}

res, err := tz.Query(timezone.Coord{
Lon: 5.261417, Lat: -3.925778,})
Lat: 5.261417, Lon: -3.925778,})
if err != nil {
fmt.Println(err)
}
Expand Down
8 changes: 4 additions & 4 deletions timezone.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ func (t *Timezone)decodeMultiPolygons(polys []interface{}) { //1

func (t *Timezone)newPolygon() (Polygon) {
return Polygon{
Max: Coord{ Lat: -180, Lon: -180, },
Min: Coord{ Lat: 180, Lon: 180, },
Max: Coord{ Lat: -90, Lon: -180, },
Min: Coord{ Lat: 90, Lon: 180, },
}
}

func (p *Polygon)updatePolygon(xy []interface{}) {
lat := float32(xy[0].(float64))
lon := float32(xy[1].(float64))
lon := float32(xy[0].(float64))
lat := float32(xy[1].(float64))

// Update max and min limits
if p.Max.Lat < lat { p.Max.Lat = lat }
Expand Down

0 comments on commit 5804073

Please sign in to comment.