andrewxhill / MOL

The Map of Life
mol.colorado.edu/
19 stars 4 forks source link

Tile service with redirect for tiles only on remote #9

Closed andrewxhill closed 13 years ago

andrewxhill commented 13 years ago

We have reviewed the tile service method options, and feel that for MOL interoperability with other projects, we can't be shipping idiosyncratic tile location mapping json, but instead just have one service that will get them the png.

So

  1. Request comes to GAE for tile ABC
  2. GAE checks that ABC is even within the BBox range of the species 3a. If No, GAE says returns a not found status code 3b. If Yes, GAE checks Memcache and Datastore for ABC 4a. if it exists in either, GAE returns the PNG 4b. if it doesn't, GAE redirects the client to the tile location on the remote server where it will be returned
eightysteele commented 13 years ago

I've started work on this issue.

eightysteele commented 13 years ago

I just pushed. See the LayersTileHandler class starting on line 261: https://github.com/andrewxhill/MOL/blob/modularize/app/mol/api/__init__.py

Here's the REST API for layer tile resources: GET /layers/species_id.png?x=5&y=3&z=4

Instead of redirecting, the API attempts to return the tile using the following process (assuming species_id, x, y, and z parameters are all valid and within bounds -- otherwise 404 or 400 is returned):

1) Start an async URL fetch for the tile on remote server 2) Check memcache and return tile if found 3) Check datastore and return tile if found 4) Get tile from async URL fetch, add it to memcache, return tile 5) If async URL fetch fails, return 404

This is slightly different from what we talked about (no redirects) and I'm totally open to changing this so let's talk it over during the meeting.

eightysteele commented 13 years ago

Changed status from Status-Started to Status-Review.

eightysteele commented 13 years ago

I'm considering an API change from:

GET /layers/species_id.png?x=5&y=3&z=4

to:

GET /layers/species_id/tiles/zoom/x/y.png

Thoughts?

andrewxhill commented 13 years ago

+1 go for it.

eightysteele commented 13 years ago

Ha, well, for now keeping it as:

GET /layers/species_id.png?x=5&y=3&z=4

The API is updated to use new key_name architecture. Closing issue.

eightysteele commented 13 years ago

I'm really closing it this time.

andrewxhill commented 13 years ago

GET /layers/species_id.png?x=5&y=3&z=4

Why did it stay like that? I can dig into fixing that after class today.

eightysteele commented 13 years ago

Why did it stay like that? I can dig into fixing that after class today.

Well, I started to re-like it again. But if we think that it's better changed, no problem. I can make the change along with some stuff I'm pushing later?