Skip to content

multiple grids#94

Open
traversc wants to merge 1 commit intomodrzew:masterfrom
traversc:master
Open

multiple grids#94
traversc wants to merge 1 commit intomodrzew:masterfrom
traversc:master

Conversation

@traversc
Copy link
Copy Markdown

@traversc traversc commented Aug 1, 2016

I modified the code to allow for multiple grids - important when trying to cover along a diagonal coast for example. You can see an example here: http://imgur.com/a/fxI4f. Should still work with only one grid.

Also, if you could add in pushbullet support directly, that would be sweet (https://github.com/Readdeo/PGOnotify).

@Zirn
Copy link
Copy Markdown

Zirn commented Aug 1, 2016

Added all your code and removed the one you removed and it is working fine with one grid.
But how do you add more grids? (sorry complete noob)
I am guessing something in the config file but how it should look like I have no idea about 😕

@traversc
Copy link
Copy Markdown
Author

traversc commented Aug 1, 2016

In the config files, start, end should be lists and grid should be a list of lists.

@VirtualSatai
Copy link
Copy Markdown

@traversc You should properly add an example of using this to the config.py.example-file :)

@traversc
Copy link
Copy Markdown
Author

traversc commented Aug 2, 2016

Here is my current config file (pretty rough outline of some areas, but just to test):

# coding: utf-8
from datetime import datetime

DB_ENGINE = 'sqlite:///db.sqlite'
AREA_NAME = 'Honolulu,HI'
MAP_START = [(21.318211, -157.862556),(21.261988, -157.822416),(21.271774, -157.806483),(21.282394, -157.848757),(21.362364, -157.940002),(21.334177, -157.888227),(21.302450, -157.820387)]
MAP_END = [(21.288576, -157.826917),(21.284586, -157.813896),(21.282170, -157.782839),(21.288562, -157.838657),(21.373704, -157.928201),(21.315106, -157.866114),(21.295714, -157.814181)]
GRID = [(3, 3),(3,1),(1,3),(1,1),(1,1),(2,2),(1,1)]  # row, column
CYCLES_PER_WORKER = 3

LAT_GAIN = 0.001
LON_GAIN = 0.0015

@andrewbroberg
Copy link
Copy Markdown

Brilliant! I'm currently running multiple workers to accomplish this for a few towns in my area. Would love to see this merged in so I only need to run 1 worker.

@DeastinY
Copy link
Copy Markdown

DeastinY commented Aug 3, 2016

Tested it for my howntown. Works great, awesome feature !
screenshot from 2016-08-03 08-53-07

@YonderGod
Copy link
Copy Markdown

YonderGod commented Aug 8, 2016

I got this to work by manually editing all the changes into the latest version EXCEPT I have to remove the lines
if odd:
row_start_lon -= 0.5 * lon_gain
because I get error:

Traceback (most recent call last): File "worker.py", line 347, in <module> spawn_workers(workers, status_bar=args.status_bar) File "worker.py", line 277, in spawn_workers points = utils.get_points_per_worker() File "C:\Users\y\Desktop\pokeminer-master - multi grids\utils.py", line 121, in get_points_per_worker points.extend(get_points_per_worker_single(config.GRID[i], config.MAP_START[i], config.MAP_END[i])) File "C:\Users\y\Desktop\pokeminer-master - multi grids\utils.py", line 98, in get_points_per_worker_single row_start_lon -= 0.5 * lon_gain TypeError: unsupported operand type(s) for -=: 'tuple' and 'float'

This makes it work, but with holes in the middle of every 4 circles, because every other row is supposed to be shifted. (http://i.imgur.com/nqtRm80.png)
Is there a way to fix this?

Comment thread utils.py
lat = (config.MAP_END[0] + config.MAP_START[0]) / 2
lon = (config.MAP_END[1] + config.MAP_START[1]) / 2
return lat, lon
if isinstance(config.GRID[0], (int, long, float, complex)):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm not a fan of checking everywhere whether config value is an int, or a list. It's better to convert old value to new format in a single place.
Moreover, if GRID can be a list, then GRID[0] may raise an IndexError.

@modrzew
Copy link
Copy Markdown
Owner

modrzew commented Aug 17, 2016

Could you rebase off master?

@traversc
Copy link
Copy Markdown
Author

Good points, about converting it to a standard format early on. In my own map, I converted to using a hexagonal grid, since it is more space efficient. We can no longer brute force large areas by throwing more accounts at it, so that would be another important change.

@Aiyubi
Copy link
Copy Markdown

Aiyubi commented Aug 17, 2016

@traversc this project uses a hex grid for quite a while now....

@traversc
Copy link
Copy Markdown
Author

@Aiyubi didn't realize! That's how old my PR is haha.

@TristanHM
Copy link
Copy Markdown

Looking forward to seeing this implemented @traversc. I hope you can get the changes in after a rebase :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants