PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

how to calculate the next location for searching pokemons?

Open kentsang77 opened this issue 10 years ago • 3 comments

What I want to do is to query a list of catchable pokemons in a big area, say 1km x 1km. I understand that I have to move step by step to getCatablePokemon() like this:

pokemongo.setLocation(latitude, longitude, altitude); pokemongo.getMap().getCatchablePokemon();

My question is: How to calculate the next latitude and longitude so that I can efficiently retrieve all catchable pokemons within the area?

efficiently here mean : use the minimum number of api calls to cover the area

kentsang77 avatar Jul 29 '16 06:07 kentsang77

I mark start point and go to every pokestops in list (filtred by distance - 1km), and check catchable pokemons for every setLocation. Remember about speed of movement.

Another way is appoint square 1km x 1km, get coordinates of corners and go to each.

Lasek avatar Jul 29 '16 07:07 Lasek

Hey, this isn't an issue related to the API so expect this to be closed without much answers, however I can help guide you in the right direction because we're all here to learn a thing or two.

I'm new to android so take it with a grain of salt, but if you look at other people's codes, such as this here: https://github.com/omkarmoghe/Pokemap

you can see how they do it. I read through his code, some of it I was able to understand, some of it flew by my head. Basically the idea is to get that circle radius around your character, and move in all directions based on that circle radius. His code is great, I'm only using this to learn so I ended up copying pretty much 100% of his helper class for the map to calculate where to move and I took parts of his code for the calculating of the 1k distance around you.

When you have your locations, just do a for loop and call the api for catchable pokemon, then plot them on the map.

Good luck!

JohnTendik avatar Jul 29 '16 07:07 JohnTendik

Yeah this is an implementation issue and not an API issue sorry

Grover-c13 avatar Jul 29 '16 07:07 Grover-c13