Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for tilesize on RedShift records #179

Merged
merged 2 commits into from
Mar 30, 2017
Merged

Account for tilesize on RedShift records #179

merged 2 commits into from
Mar 30, 2017

Conversation

iandees
Copy link
Member

@iandees iandees commented Mar 29, 2017

Follow of #178, #176.

Standardize on 512px-sized tiles in the tiles of interest by "zooming out" the records from RedShift if they don't specify 512px as the requested tile size.

It's not guaranteed that we want the globe from z0-z9 in the TOI, for example
and (x between 0 and pow(2,z)-1)
and (y between 0 and pow(2,z)-1)
group by z, x, y
order by z, x, y;""".format(days=redshift_days_to_query))
n_trr = cur.rowcount
for (x, y, z) in cur:
for (x, y, z, tile_size) in cur:
Copy link
Member

Choose a reason for hiding this comment

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

Don't need the parens here, but I know that @zerebubuth likes seeing them so up to you :)

Copy link
Member

Choose a reason for hiding this comment

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

Indeed! I do like parens - mainly because I can't remember precedence rules or, as in this case, like being reminded that we're destructuring a tuple.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was being extra explicit with parens in the SQL above so I kept going in the Python here. 😄 I'm going to keep it.

from tile_traffic_v4
where (date >= dateadd(day, -{days}, current_date))
and (z between 10 and 16)
and (z between 0 and 15)
Copy link
Member

Choose a reason for hiding this comment

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

Are we going to be pruning low zoom level tiles too? ie 0-10, err 0-9 now?

Copy link
Member Author

Choose a reason for hiding this comment

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

I made this change because I didn't want to assume we always wanted to have zooms 0 through 9 in the TOI. In my sample configuration I have the whole Earth at z0-z9 as an "immortal" area, so it gets added to the TOI that way.

@iandees iandees merged commit 9fa942f into master Mar 30, 2017
@iandees iandees removed the in review label Mar 30, 2017
@iandees iandees deleted the prune_toi_command branch March 30, 2017 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants