-
-
Notifications
You must be signed in to change notification settings - Fork 38
Tile grid #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tile grid #105
Conversation
…a check for the SRID (L25-27) from the grid to allow for increased coverage. Adjusted the test areas from directional (north, east, south, west) to quadrants [1-4].
34863a0
to
e8c68ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some minor changes. Thanks for finishing this up!
slippy/tile_grid_test.go
Outdated
srid uint | ||
zoom uint | ||
expected uint | ||
expected [2]uint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change this (and the test cases) to geom.Point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, these are tile coordinates. Here, the zoom
and expected
can be joined into a single field with type *Tile
(NewTile
returns a pointer).
Note: structs can be compared like *tc.expected == *tile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't you need the grid first before creating the tile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
slippy/tile_grid_test.go
Outdated
srid uint | ||
zoom uint | ||
expected float64 | ||
expected [2]float64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change this (and the test cases) to geom.Point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
slippy/tile_grid_test.go
Outdated
"3857_south": { | ||
lat: -85.0511, | ||
"3857_z0_random": { | ||
point: geom.Point{0, 0 + rand.Float64() * 85.0511}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go's math/rand
generator is deterministic, so this will always be the same number. The same behavior is good for tests, but the use of the package is misleading. Use a literal instead like 12.345
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
slippy/tile_grid_test.go
Outdated
x uint | ||
y uint | ||
srid uint | ||
zoom uint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The zoom
, x
, and y
here should also be contained into a tile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
slippy/tile_grid_test.go
Outdated
|
||
if !cmp.Float(pt.X(), tc.expected) { | ||
t.Errorf("got %v expected %v", pt.X(), tc.expected) | ||
if pt != tc.expected { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use cmp.PointEqual(pt, tc.expected)
(from github.com/go-spatial/geom/cmp
). This is the package we use for floating point comparisons since, plain ==
is unstable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test cases can be left as is btw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified as requested
@BerryDaniel LGTM thank you! |
Consolidated X and Y tests for FromNative and ToNative. I also added a check for the SRID (L25-27) from the grid to allow for increased coverage. Adjusted the test areas from directional (north, east, south, west) to quadrants [1-4].
rebased to address merge conflict