Pokemon-Go-Rocket-API icon indicating copy to clipboard operation
Pokemon-Go-Rocket-API copied to clipboard

GetMapObjects doesn't always return pokestops/pokemons

Open Da-Teach opened this issue 8 years ago • 19 comments

Although this could be an issue with PokemonGo itself, I feel that it could be related to S2Helper.GetNearbyCellIds . If you visualize the pokestops that get returned by GetMapObjects you will often see that (for example) only pokestops north of the player get returned.

Is there maybe a limit to the number of pokestops returned? (although that doesn't explain why sometimes it doesn't return any).

Da-Teach avatar Aug 02 '16 09:08 Da-Teach

I experience missing pokestops as well. But it looks like it is not related to a direction, because there are some stops NEVER returned by the API (but I can see them in the app).

ghost avatar Aug 02 '16 11:08 ghost

I tested yesterday in central park and many forts appeared. But today when I tried to bot again, just 21 mapcells without forts has been returned.

Corlobin avatar Aug 02 '16 12:08 Corlobin

https://github.com/FeroxRev/Pokemon-Go-Rocket-API/commit/1a723cc08b5a92fa48221f8e6ddaaf9d27f4bd39

Does this fix the issue? :)

FeroxRev avatar Aug 02 '16 14:08 FeroxRev

This definitely changed the result set. The pokestops around the player look more like a sphere. Will do some more testing to see if it's fixed :)

Da-Teach avatar Aug 02 '16 14:08 Da-Teach

Unfortunately it's still not fixxed on my end. It only finds 2 out of 60ish pokestops :(

ghost avatar Aug 02 '16 14:08 ghost

Are you sure you select all pokestops from all cellids and not just the first? @MarkMeier

FeroxRev avatar Aug 02 '16 14:08 FeroxRev

var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.Ticks); foreach (var pokeStop in pokeStops)

this worked before the patch so I don't see why it shouldn't be working now. Even if i manually check all the mapcells forts are always empty. Should I give you more info about the position/mapcells etc?

ghost avatar Aug 02 '16 15:08 ghost

var mapObjects = await client.Map.GetMapObjects();

var pokeStops = mapObjects.Item1.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime()).ToArray();

this is what im trying to do with newest version but still always empty? :(

raotskuhh avatar Aug 02 '16 19:08 raotskuhh

Am i doing something wrong?

raotskuhh avatar Aug 02 '16 19:08 raotskuhh

No, you arent. I have the same issue. It's strange.

Corlobin avatar Aug 02 '16 21:08 Corlobin

Strange, anyone know a solution?

raotskuhh avatar Aug 02 '16 21:08 raotskuhh

Sorry for hijacking this, but I think I'm having the same issue.

It seems to me that having more than 1 request each 10 seconds causes them to return 21 empty cells as @Corlobin said.

I'm not really sure if this is a timing issue, but I've never encountered this issue when I update the map every 10 seconds, it only happens when I'm forced to update between those 10 seconds intervals.

ST-Apps avatar Aug 02 '16 21:08 ST-Apps

I think you are right. When I try at the first time to retrieve the map I receive just 21 cells. I put a Task.Delay(15000) and after a while the map showed.

Well, I am using this code and seems fine!

Hope it help.


private async Task<IEnumerable<FortData>> GetPokestops(CustomClient client)
        {
            var mapObjects = await player.Map.GetMapObjects();

            var pokeStops = mapObjects.Item1.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint && i.CooldownCompleteTimestampMs < DateTime.UtcNow.ToUnixTime());
            pokeStops = pokeStops.OrderBy(i => Utility.CalculateDistanceInMeters(
                    new Location(player.CurrentLatitude, player.CurrentLongitude), new Location(i.Latitude, i.Longitude)));
            do
            {

                Thread.Sleep(15000);
                if (pokeStops.Count() > 0)
                    break;

                mapObjects = await player.Map.GetMapObjects();
                pokeStops = mapObjects.Item1.MapCells.SelectMany(i => i.Forts).Where(i => i.Type == FortType.Checkpoint );
                pokeStops = pokeStops.OrderBy(i => Utility.CalculateDistanceInMeters(
                        new Location(player.CurrentLatitude, player.CurrentLongitude), new Location(i.Latitude, i.Longitude)));

            } while (pokeStops.Count() == 0);

            return pokeStops;
        }


Corlobin avatar Aug 02 '16 21:08 Corlobin

Check it

Corlobin avatar Aug 03 '16 02:08 Corlobin

Is this working good for you?

raotskuhh avatar Aug 03 '16 07:08 raotskuhh

I have two problems : First is : If I search to find pokémons and pokéstops (with two call of GetMapObjects), only the the first call is correct : pokémon appear. Not the pokestops on the second call.

Second : When I only call one GetMapObjects for the pokestops, the response is not really "cool" with the radius : http://image.prntscr.com/image/db9efbbefd5e450a8e67b1a0208549a1.png

Megurine avatar Aug 03 '16 08:08 Megurine

@Megurine as I said above, the issue is probably related to request timing. Issuing more than one request each 10 seconds returns empty data. You may want to get both pokemons and pokestop in the same request, since they're all returned by the same method.

ST-Apps avatar Aug 03 '16 08:08 ST-Apps

@ST-Apps Hmm I think its 5 seconds , so for the first problem I scan the pokémon and pokéstop on the same GetMapObjects request :) (surely a Niantic restriction)

But the second problem is strange =S

Megurine avatar Aug 03 '16 08:08 Megurine

confirmed 10s

ST-Apps avatar Aug 03 '16 08:08 ST-Apps