paulmach / orb

Types and utilities for working with 2d geometry in Golang
MIT License
892 stars 104 forks source link

tile level (>20), mercator(minx,miny) will overflow #71

Closed lujieha closed 2 years ago

lujieha commented 2 years ago

https://github.com/paulmach/orb/blob/ba1cf206b6a28651b920834d26baac25c5476e64/encoding/mvt/projection.go#L23 tile:={x:1730576,y:798477,z:21} //n=12(4096) minx := float64(tile.X << n) //minx=2793472000 (overflow)

The code is modified : minx := float64(uint64(tile.X) << n) //minx=7088439296 (correct)

Similar bugs may appear in other codes...

paulmach commented 2 years ago

fixed in https://github.com/paulmach/orb/pull/74 released in v0.3.0