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

Implementing higher zoom levels for coastal datasets #425

Merged
merged 40 commits into from May 21, 2019
Merged

Implementing higher zoom levels for coastal datasets #425

merged 40 commits into from May 21, 2019

Conversation

jamesprayner
Copy link
Collaborator

@jamesprayner jamesprayner commented May 16, 2019

What is this PR doing?

Resolves #356
Resolves #357
Resolves #358

Implementing a way to display zoom levels past level 8 (currently levels up to 13 are working with this update). Next step is to add the coastal data to dory so this feature can be used efficiently.

This also resolves #4 (finally!) by changing the source of the tiles on zoom level 8.

Why have you chosen this approach?

The original idea in #356 was to use a vector layer with a single geojson file to display bathymetry and do something similar for #358. Turns out rendering a massive geojson file is very tough on performance, even with a simplified file.
VectorTile layers are easier on the client and don't have a single 500MB file associated with it that needs to be downloaded before anything can be displayed. The mbt format (mapbox tiles) is a compressed version of a geojson, so they're smaller and require even less resources.
The mbt data is stored in SQLite files with the extension ".mbtiles", if not for this each installation of the navigator would need to downloading and extracting an archive with 4^13 sub directories (this takes far too much time).

Should reviewers focus on anything specific?

Check the sanity of the API changes, since some old code (only slightly) was changed to this working.

  • I have tested my changes.
  • (If applicable): I ran npm run lint and resolved all errors.

James Rayner and others added 30 commits February 28, 2019 13:38
Merge new master into downscaling
- deleted geojsons from previous attempts
- forgot this was important
- exactly the same as having preloading at infinity for max zoom level 8
- this helps performance at higher zoom levels on lower end machines
James Rayner and others added 3 commits May 16, 2019 11:48
- changed layer_bath url back to the old api so old caches still work
@jamesprayner
Copy link
Collaborator Author

The new MBTiles files are being hosted on Dory and have been included in the install script.

@htmlboss htmlboss added this to In progress in Ocean Navigator via automation May 17, 2019
@htmlboss htmlboss moved this from In progress to Review in progress in Ocean Navigator May 17, 2019
Copy link
Contributor

@htmlboss htmlboss left a comment

Choose a reason for hiding this comment

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

Few comments hehe. Good work though.

oceannavigator/frontend/src/components/Map.jsx Outdated Show resolved Hide resolved
oceannavigator/frontend/src/components/Map.jsx Outdated Show resolved Hide resolved
oceannavigator/frontend/src/components/Map.jsx Outdated Show resolved Hide resolved
oceannavigator/oceannavigator.cfg Show resolved Hide resolved
plotting/tile.py Outdated Show resolved Hide resolved
routes/routes_impl.py Show resolved Hide resolved
routes/routes_impl.py Outdated Show resolved Hide resolved
routes/routes_impl.py Outdated Show resolved Hide resolved
f.write(tile[0])
with gzip.open(directory + ".pbf", 'rb') as gzipped:
with open(directory, 'wb') as tileout:
shutil.copyfileobj(gzipped, tileout)
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm reading this code correctly, we're:

  • Writing out the fetched tile from sqlite as a .pbf
  • Reading it back in through gzip.
  • Copying the contents of that .pbf into the requested tile file.

Do I have this correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's what's happening. If you have a nicer way off the top of your head I'm all ears

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering can we just write directly to the tile file and skip the pbf entirely?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like gzip doesn't like bytesio objects for some reason. I'll create an issue and we can look at this later.

routes/routes_impl.py Outdated Show resolved Hide resolved
James Rayner and others added 7 commits May 17, 2019 16:48
- Defined as a variable
- Now using MAX_ZOOM[this.props.state.projection]
- Made mbt_imp a bit clearer
- code more likely to run now runs first
Ocean Navigator automation moved this from Review in progress to Reviewer approved May 21, 2019
Copy link
Contributor

@htmlboss htmlboss left a comment

Choose a reason for hiding this comment

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

🚢 Nice work 👍

@jamesprayner jamesprayner merged commit 91cd3bd into DFO-Ocean-Navigator:master May 21, 2019
Ocean Navigator automation moved this from Reviewer approved to Done May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
2 participants