Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ templates/footer.html
*.so
*.dll
*.dylib
*.data
6 changes: 6 additions & 0 deletions config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ PROXIES = None # Insert dictionary with 'http' and 'https' keys to enable

SCAN_RADIUS = 70 # metres


# Higher value, fewer scanpoints are necessary, however there's obviously
# a lower cap and the runtime increases exponentially, so don't set it
# much higher
SAMPLES_PER_POINT = 5

ACCOUNTS = [
('ash_ketchum', 'pik4chu', 'ptc'),
('ziemniak_kalafior', 'ogorek', 'google'),
Expand Down
23 changes: 23 additions & 0 deletions db.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,3 +427,26 @@ def get_all_spawn_coords(session, pokemon_id=None):
if config.REPORT_SINCE:
points = points.filter(Sighting.expire_timestamp > get_since())
return points.all()

def get_known_spawnpoints(session):
query = ('''
SELECT lat, lon
FROM sightings
WHERE
lat >= {lat_start} AND
lat <= {lat_end} AND
lon >= {lon_start} AND
lon <= {lon_end}
GROUP BY spawn_id;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont know if spawn_id is unique. Better GROUP BY lat,lon ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually spawn_id is unique, but I can change it anyway as it shouldn't really make a difference :)

Copy link
Copy Markdown

@Aiyubi Aiyubi Aug 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

267k records in one db, 562k in the other. 505 duplicate spawn ids.

Source: https://www.reddit.com/r/pokemongodev/comments/4vazmk/encounter_id_is_not_unique/
Title says encounter_id but really is spawn_id if you read it

Copy link
Copy Markdown
Author

@rollator rollator Aug 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I'm not really conviced he's talking about the id of spawn points. He only mentions "spawn id" once and from the context it seems like he's talking about the encounter_id field.
In our db, spawn_id is spawn point id, not encounter_id, right?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, we dont save the encounter id at all

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do save encounter_id on the sightings table.

'''.format(
lat_start=min(config.MAP_START[0], config.MAP_END[0]),
lat_end=max(config.MAP_START[0], config.MAP_END[0]),
lon_start=min(config.MAP_START[1], config.MAP_END[1]),
lon_end=max(config.MAP_START[1], config.MAP_END[1])
))
query = session.execute(query)
results = []
for x in query.fetchall():
results.append((float(x[0]), float(x[1])))
return results

3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ werkzeug==0.11.10
sqlalchemy==1.0.14
-e git+https://github.com/keyphact/pgoapi.git@39ea20d31b770dd7bc83180d60283e171090e16d#egg=pgoapi
enum34==1.1.6
intervaltree==2.1.0
numpy==1.11.1
scipy==0.18.0
Loading