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

Add RAWR data fetcher #244

Merged
merged 19 commits into from
Oct 4, 2017
Merged

Add RAWR data fetcher #244

merged 19 commits into from
Oct 4, 2017

Conversation

zerebubuth
Copy link
Member

This adds a RAWR compatible data fetcher, although it isn't hooked up to actually download tiles at the moment. The only use of it is from the test suite. The next step will be to hook it into the rendering pipeline and allow configuring it.

Several issues with the current approach (shared with the fixture data fetcher):

  1. There's a lot of hard-coded stuff that relates to "style" decisions that seem like they'd be better in vector-datasource. Hopefully once the code is working, we can pull those out and put them wherever would be more appropriate.
  2. The staging in the indexing is quite delicate, to make sure that data is read only once. This might make it brittle, but it's hard to tell when it's just running through the test suite.

Matt Amos added 19 commits September 29, 2017 13:18
This is now in `common.py`, making it easier to see where the shared code is. Also factored out an interface, implemented by OsmFixtureLookup, which is used to make queries about relationships between elements; mainly station relation complexes and highway routes, etc...
Previously, the code looped over layers and looked up features in a per-layer index. This caused a problem for some types of processing. For example, for a feature which might appear in `pois`, `landuse` and `buildings` layers, that only one of those features is named. This is considerably harder to do when the feature is extracted from several different indexes. Another issue was that the properties were copied for each feature and in each layer to add the `min_zoom` property, which meant that there was a lot more memory usage and GC pressure. Since the size of RAWR tiles is a concern, it would be better to keep the memory usage down where possible.

The new code has a single index, and keeps `min_zoom` for each layer in a separate `dict`. This means that the code which iterates over the layers has to do a second check for the zoom level, and the feature is included at the minimum zoom level it appears in any layer.

A side effect of this is that each `_Feature` object is unique, and so we can use `id()` to check equality, which helps when de-duplicating across tiles.
@zerebubuth zerebubuth requested a review from rmarianski October 3, 2017 18:38
Copy link
Member

@rmarianski rmarianski left a comment

Choose a reason for hiding this comment

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

LGTM!

About the data fetcher itself, it looks like we're going to be creating a new one for each tile pyramid. Are we going to introduce a higher level concept, like a data service abstraction, that manages this given any tile? Who will fetch the data from s3 and hand that to the data fetcher?


def tile(self):
from raw_tiles.tile import Tile
return Tile(self.z, self.x, self.y)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should at some point just create our own repo to hold these kinds of objects and related utility functions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Follow-up in #246.

@staticmethod
def lookup(typ):
"turn the enum into a string"
return ShapeType._LOOKUP[typ-1]
Copy link
Member

Choose a reason for hiding this comment

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

What do you think of using the enum package here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. At first, it didn't seem necessary to bring that in for something which, at least initially, was very simple. After adding the lookup function, it's starting to look like it would be cleaner with the enum package. Fixed in #247.

@zerebubuth zerebubuth merged commit 901841c into master Oct 4, 2017
@zerebubuth zerebubuth deleted the zerebubuth/rawr-tiles-phase3 branch October 4, 2017 10:24
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.

2 participants