kungfoo / geohash-java

Implementation of GeoHashes in java. We try to be/stay compliant to the spec, as far as possible.
Other
985 stars 309 forks source link

GeoHash.withBitPrecision accepts negative values for bit precision #58

Closed satorg closed 2 years ago

satorg commented 2 years ago

Example:

GeoHash.withBitPrecision(12.345, 67.89, -1)

results to

0000000000000000000000000000000000000000000000000000000000000000 -> (90.0,-180.0) -> (-90.0,180.0) ->

I.e. any negative value is treated just as zero.

Expected behavior: an IllegalArgumentException is thrown for all values that are not within the [0..64] (inclusive) range.

Version affected: 1.4.0