nextstrain / auspice

Web app for visualizing pathogen evolution
https://docs.nextstrain.org/projects/auspice/
GNU Affero General Public License v3.0
290 stars 161 forks source link

Better document swapping map tilesets #1286

Closed michalkowalski94 closed 3 years ago

michalkowalski94 commented 3 years ago

Current Behavior
When running auspice view locally and in container, map is a huge gray rectangle

Expected behavior
Working map like it supposed to

How to reproduce
Steps to reproduce the current behavior:

  1. Install however you like, from source with nodejs via package manager or via conda with source
  2. auspice view
  3. map is a gray rectangle

Possible solution
No idea

Your environment: if browsing Nextstrain online

Your environment: if running Nextstrain locally

Additional context
image

emmahodcroft commented 3 years ago

Hi @michalkowalski94 ! Sorry for this causing you trouble. This isn't my area of expertise, but just to check something - does the container have access to the internet? The map has to be download on first launch and at every zoom level, so this could be the issue. However, if it does have internet there's clearly another problem at work, and hopefully another person from the team can have a look soon!

michalkowalski94 commented 3 years ago

Hi, it actually does not work even if auspice is not in container. Container is exposed to public zone and has access to internet via docker bridge network. Thank You for quick response

rneher commented 3 years ago

We have been rotating mapbox tokens, but the new ones should work for localhost. Please check in the browser console why/if the mapbox request fails. @trvrb or @jameshadfield might know more.

rneher commented 3 years ago

some privacy extensions also block fetching of tiles. But I see you tested many browsers, so that is probably not the issue.

michalkowalski94 commented 3 years ago

Okay, changed in src/util/globals.js api to

export const getMapTilesSettings = () => {
  if (hasExtension("mapTiles")) {
    return getExtension("mapTiles");
  }
  /* defaults */
  const api = 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png';
  return {
    api,
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    mapboxWordmark: true
  };
};

It solved the problem and licensing is more humanitarian. Extending with auspice build --extend filename.json resulted in dumped core

jameshadfield commented 3 years ago

This is due to the new mapbox tokens we are using being rejected due to the doman that auspice is running on. What is the browser address you are viewing auspice through? (You are running auspice view so I expect this is http://localhost:4000 but want to double check)

In the meantime, you can temporarily downgrade auspice to 2.21.0 to fix this.

Extending with auspice build --extend filename.json resulted in dumped core

Would you mind posting this error log somewhere to help us debug this (unrelated) issue?

nkeito commented 3 years ago

In the meantime, you can temporarily downgrade auspice to 2.21.0 to fix this.

How can this be acheived by using a docker image? Because, I tried to do npm uninstall auspice

ThijnvanKempen commented 3 years ago

We are also running into the same problem, the map is working on the localhost but not on the hosted webaddress.

Please see: nextstrain.nrcnvwa.nl for examples.

Hopefully you can help us to fix this, since downgrading to auspice 2.21.0 does not work for us.

Kind regards

jameshadfield commented 3 years ago

Hi @ThijnvanKempen -- these tokens have stopped working on hosted instances of auspice, as each use incurs a fee for us! The docs provide a way for you to provide your own token at auspice build time. (And this also lets you choose the style of map tiles you wish.) If those instructions don't work, please make an issue detailing which commands you ran & the terminal output / error message(s) and i'll happily help debug it.

ThijnvanKempen commented 3 years ago

Hi @jameshadfield,

Thank you for the reply. And thanks for the help. We managed to work it out!

Kind regards, Thijn

ThijnvanKempen commented 3 years ago

Hi @dwwhall,

For me it worked to change the API code section in global.js file found in util/etc. Afterwards I just ran the auspice build (no extend) and it worked for me. Hopefully this also works for you.

trvrb commented 3 years ago

I suspect this is still confusing a number of users. Perhaps the main thing that can be done is to slightly expand out https://docs.nextstrain.org/projects/auspice/en/stable/customise-client/api.html#custom-map-tiles? I'm not sure I would have understood what to enter under mapTiles.api. Just give an example from MapBox and an example from OpenStreetMaps.

jameshadfield commented 3 years ago

Update: please see these steps on discussion.nextstrain.org for a hands-on approach to setting custom tile API.

Leaving this issue open until I've added this to the actual docs.