Skip to content
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

Geohash->encode() can't be called twice on same object #73

Open
laufhannes opened this issue Nov 1, 2015 · 1 comment
Open

Geohash->encode() can't be called twice on same object #73

laufhannes opened this issue Nov 1, 2015 · 1 comment
Labels

Comments

@laufhannes
Copy link

For the matter of performance, I don't want to create a new Geohash object within a large for loop encoding thousands of coordinates to their respective geohashes. But as far as I can see, it's methods are not meant to be called twice.

Example:

use League\Geotools\Geohash\Geohash;

$Hash = new Geohash();
echo $Hash->encode(new Coordinate(array(0, 0)), 12); // prints "7zzzzzzzzzzz" as expected
echo $Hash->encode(new Coordinate(array(49, 7)), 12); // still prints "7zzzzzzzzzzz" instead of "u0syz21jxy43"

Looking at the code, that's quite obvious. First of all, latitude and longitude interval are used from the previous encoding (see Geohash.php#L134-L135) and the geohash is never set back to an empty string.

Is there any reason for that?

@toin0u
Copy link
Member

toin0u commented Jan 22, 2016

Hi @laufhannes - sorry for the late answer.
There is no good reason for that. I was thinking to reimplement the way to use it..

@toin0u toin0u added the bug label Jan 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants