mirror of https://github.com/tidwall/tile38.git
minor code cleanup
This commit is contained in:
parent
9ffca9aa10
commit
bce78028bb
|
@ -170,7 +170,7 @@ func (b BBox) Sparse(amount byte) []BBox {
|
||||||
// BBoxesFromCenter calculates the bounding box surrounding a circle.
|
// BBoxesFromCenter calculates the bounding box surrounding a circle.
|
||||||
func BBoxesFromCenter(lat, lon, meters float64) (outer BBox) {
|
func BBoxesFromCenter(lat, lon, meters float64) (outer BBox) {
|
||||||
|
|
||||||
outer.Min.Y, outer.Min.X, outer.Max.Y, outer.Max.X = BBoxBounds(lat, lon, meters)
|
outer.Min.Y, outer.Min.X, outer.Max.Y, outer.Max.X = BoundsFromCenter(lat, lon, meters)
|
||||||
if outer.Min.X == outer.Max.X {
|
if outer.Min.X == outer.Max.X {
|
||||||
switch outer.Min.X {
|
switch outer.Min.X {
|
||||||
case -180:
|
case -180:
|
||||||
|
@ -183,7 +183,8 @@ func BBoxesFromCenter(lat, lon, meters float64) (outer BBox) {
|
||||||
return outer
|
return outer
|
||||||
}
|
}
|
||||||
|
|
||||||
func BBoxBounds(lat, lon, meters float64) (latMin, lonMin, latMax, lonMax float64) {
|
// BoundsFromCenter calculates the bounding box surrounding a circle.
|
||||||
|
func BoundsFromCenter(lat, lon, meters float64) (latMin, lonMin, latMax, lonMax float64) {
|
||||||
|
|
||||||
// see http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates#Latitude
|
// see http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates#Latitude
|
||||||
lat = toRadians(lat)
|
lat = toRadians(lat)
|
||||||
|
|
|
@ -116,7 +116,7 @@ func TestComplexFeature(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
o = o
|
_ = o
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIssue245(t *testing.T) {
|
func TestIssue245(t *testing.T) {
|
||||||
|
|
|
@ -31,11 +31,11 @@ var ( // json errors
|
||||||
fmtErrTypeIsUnknown = "The type '%s' is unknown"
|
fmtErrTypeIsUnknown = "The type '%s' is unknown"
|
||||||
errInvalidTypeMember = errors.New("Type member is invalid. Expecting a string")
|
errInvalidTypeMember = errors.New("Type member is invalid. Expecting a string")
|
||||||
errInvalidCoordinates = errors.New("Coordinates member is invalid. Expecting an array")
|
errInvalidCoordinates = errors.New("Coordinates member is invalid. Expecting an array")
|
||||||
errCoordinatesRequired = errors.New("Coordinates member is required.")
|
errCoordinatesRequired = errors.New("Coordinates member is required")
|
||||||
errInvalidGeometries = errors.New("Geometries member is invalid. Expecting an array")
|
errInvalidGeometries = errors.New("Geometries member is invalid. Expecting an array")
|
||||||
errGeometriesRequired = errors.New("Geometries member is required.")
|
errGeometriesRequired = errors.New("Geometries member is required")
|
||||||
errInvalidGeometryMember = errors.New("Geometry member is invalid. Expecting an object")
|
errInvalidGeometryMember = errors.New("Geometry member is invalid. Expecting an object")
|
||||||
errGeometryMemberRequired = errors.New("Geometry member is required.")
|
errGeometryMemberRequired = errors.New("Geometry member is required")
|
||||||
errInvalidFeaturesMember = errors.New("Features member is invalid. Expecting an array")
|
errInvalidFeaturesMember = errors.New("Features member is invalid. Expecting an array")
|
||||||
errFeaturesMemberRequired = errors.New("Features member is required")
|
errFeaturesMemberRequired = errors.New("Features member is required")
|
||||||
errInvalidFeature = errors.New("Invalid feature in collection")
|
errInvalidFeature = errors.New("Invalid feature in collection")
|
||||||
|
|
Loading…
Reference in New Issue