Comments (23)
Need to increase radius of get map objects call to 1000
from pokemongo-api.
from pokemongo-api.
@jmangeja1 to 1000 !?
Even on 10 I find 196 pokestops, how can that radius be too low for decent pokemons ? 👯
Any idea about my 're-using' mapobjects issue? Looks like I can't re-use it at all, as it appears empty by then :S
from pokemongo-api.
@dnsBlah I actually haven't used this Ali, but if you look at keyphacts phosphine you'll see they use 1000 as the radius
from pokemongo-api.
Sorry my spelling is awful. I'm on an iPhone. Ali= API
Phosphine = pygo api
from pokemongo-api.
hmmm I will have a look in that later then
dont worry, same thing here ;-)
from pokemongo-api.
I do see a limit of 100 there, going to give it a try :)
With laods of delays I'm already getting more results.
Still an issue when re-using mapobjects like this:
aCells = getMapObjects(session)
pokemons = getPokemonsNearby(session, aCells)
for pokemon in pokemons:
#looping here
pokeForts = getPokeFortsNearby(session,aCells)
#from here aCells is empty! :-/
getPokemonsNearby and getPokeFortsNearby look like this:
#get pokemons
def getPokemonsNearby(session, cells):
tPokemons = []
latitude, longitude, _ = session.getCoordinates()
for cell in cells.map_cells:
pokemons = [p for p in cell.wild_pokemons] + [p for p in cell.catchable_pokemons]
for pokemon in pokemons:
dist = Location.getDistance(
latitude,
longitude,
pokemon.latitude,
pokemon.longitude
)
tPokemons.append({'distance': dist, 'pokemon': pokemon})
if len(tPokemons) == 0:
cells = getMapObjects(session, 10)
for cell in cells.map_cells:
pokemons = [p for p in cell.wild_pokemons] + [p for p in cell.catchable_pokemons]
for pokemon in pokemons:
dist = Location.getDistance(
latitude,
longitude,
pokemon.latitude,
pokemon.longitude
)
tPokemons.append({'distance': dist, 'pokemon': pokemon})
tPokemons = sorted(tPokemons, key=lambda k: k['distance'])
return [instance['pokemon'] for instance in tPokemons]
#get forts (pokestops and gyms)
def getPokeFortsNearby(session, cells):
ordered_forts = []
latitude, longitude, _ = session.getCoordinates()
for cell in cells.map_cells:
for fort in cell.forts:
dist = Location.getDistance(
latitude,
longitude,
fort.latitude,
fort.longitude
)
if fort.type == 1:
if fort.cooldown_complete_timestamp_ms<time.time():
ordered_forts.append({'distance': dist, 'fort': fort})
else:
ordered_forts.append({'distance': dist, 'fort': fort})
ordered_forts = sorted(ordered_forts, key=lambda k: k['distance'])
return [instance['fort'] for instance in ordered_forts]
As far as I know, I'm not getting 'new' mapObjects, just trying to re-use the mapobjects i retrieved earlier.
Any idea?
from pokemongo-api.
@dnsBlah. Yea, you can only scan a short distance for Pokemon so not many will show up. I recommend implementing a mapping tool and incorporating that in your program
from pokemongo-api.
@jmangeja1 Yes I gathered that one :)
I also think there will be a proto update soon related to pokemons nearby, as its back in the game
Anyways yet I don't understand the second part
I retrieve map objects and store it in a variable (aCells)
when I print that variable, I see forts and pokemons
Now I'm using this variable to filter out pokemons and store it in another variable (pokemons)
i loop through them, walk and catch
when finished I use the aCells to filter out the forts
and store it pokeForts
but pokeForts got empty!?
If I print aCells after the pokemon loop
the aCells got empty cells
I haven't rechecked mapobjects yet
Why is it empty?
from pokemongo-api.
@dnsBlah I'm learning N as I go with this app, but what do you mean there has been an update to pokemons nearby in the game?
Regarding your second question as to why the Acells empty... Are you modifying acells as you loop through Pokemon?
from pokemongo-api.
@dnsBlah let me read your source code posted above.
from pokemongo-api.
@dnsBlah in function getnearbypokemons look at the line cells= getmapobjects(radius =10) that's clearing acells because radius is only 10 and its overwriting acells
from pokemongo-api.
actually I don't think that should affect it
from pokemongo-api.
could someone tell me where to place this libencrypt.so
from pokemongo-api.
Place it in same directory as the python program that you are running or edit path to include it
from pokemongo-api.
still it says no forts found.. what could be the problem?
from pokemongo-api.
Did you download correct version? I actually don't use this Ali. I use keyphacts edited pgoapi
from pokemongo-api.
i just downloaded it.. its the latest one
from pokemongo-api.
Hi @jmangeja1 ,
thanks for your time, but I only do
cells = getMapObjects(session, 10)
When I don't see any pokemons. Just for the... you know, maybe there are a few in the area where I am at that moment, instead of the area where I scanned aCells
Next to that, it will be stored as 'cells', and not 'aCells' as I pass it to the location :)
And if radius 10 is too low, I even put it on 9 now. As it gives me more often results without multiple loops and sleep times.
[ ] Found 147 Forts nearby
*** These are pokestops AND gyms ofcourse.
pgoapi / kryphacts are using radius in meters I guess.
But indeed, I'm also only getting empty cells there.
from pokemongo-api.
@dnsBlah that line is called when you don't find any Pokemon so it might be clearing out the cells variable. I would test that. Take out that getmapcells call inside the get pokemonsnearby and see if that works. I think that's why your forts are empty
from pokemongo-api.
@jmangeja1 is it possible by calling getmapobjects to return to a variable named cells inside pokemonsnearby function, to overwrite an older variable named aCells, which is even outside that function, and without mentioning it to be global at the beginning of pokemonsnearby function?
Then it's time to stop doing python...
Maybe its a bug/'unsolved feature' from proto's ? They work in 'memory/cache' ? Is getmapobjects stored in something like 'cache' instead of the variable I defined?
from pokemongo-api.
I would google a little but on Python pass by object reference. This is the explanation of how Python passes arguments in functions. From what I can remember a cells should be unaffected once you reassign something in a function. So I'm not sure why you're cells are being cleared out.
from pokemongo-api.
It's ok for now.. with my workaround with threshold delays
Still, I find it weird that it hardly sees any.
from pokemongo-api.
Related Issues (20)
- How to determine the level of PokeGym? HOT 1
- Question about use HOT 3
- Error in Geo Request HOT 6
- Connection problems HOT 1
- Question about use of coordinates. HOT 2
- Clarification on `episilon` and `step` in `trainer.WalkTo` HOT 2
- AttributeError: 'str' object has no attribute 'noop' HOT 3
- TypeError: __init__() got an unexpected keyword argument 'auth'
- Error: Expected a bytes-like object, str found HOT 1
- Can't find pokestops HOT 1
- No update?
- Connection problem since 13/02/17 HOT 1
- TypeError: sequence item 0: expected a bytes-like object, str found HOT 1
- Proposing a PR to fix a few small typos
- Pip install error
- Unknown 6 error HOT 2
- findBestPokemon() function not working ? HOT 5
- setFavoritePokemon proto fix HOT 7
- Update Readme HOT 1
- Help: How to apply a lure module to a pokestop ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pokemongo-api.