-
Notifications
You must be signed in to change notification settings - Fork 50
updating mapbox token #8
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
Conversation
e594d84
to
9d0ad9c
Compare
r/2019-09-20-mapbox-layers.Rmd
Outdated
@@ -164,14 +131,31 @@ p <- us_cities %>% | |||
p | |||
``` | |||
|
|||
### Mapbox Access Tokens and When You Need Them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this back up to the top plz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to top.
remove mapbox token from ci using correct attribute name for mapbox token moving access token paragraph to top of mapbox-layers example re-adding token to examples that need it
cfe8120
to
603b870
Compare
mapboxToken <- paste(readLines("../.mapbox_token"), collapse="") # You need your own token | ||
|
||
# Setting mapbox token for R environment | ||
Sys.setenv("MAPBOX_TOKEN" = mapboxToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm pretty sure that either this Sys.setenv
line or the config(accesstoken = mapboxToken)
line are required but not both, just like in Javascript. Can you please update these docs to use one or the other and actually document this behaviour in the mapbox-layers
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From testing in my local dev environment, it seems like Sys.setenv
is not a valid way of passing the token.
Edit: this turns out to be the case only if using the plot_mapbox()
call signature instead of the plot_ly
call signature.
r/2019-09-20-mapbox-layers.Rmd
Outdated
<li> `layout.mapbox.layers` is an array that defines more layers that are by default rendered above the traces in `data` (although this can also be controlled via the `below` attribute).</li> | ||
</ol> | ||
|
||
|
||
### Mapbox Access Tokens and When You Need Them | ||
|
||
The word "mapbox" in the trace names and `layout.mapbox` refers to the Mapbox.js open-source library. If your basemap in `layout.mapbox.style` uses data from the Mapbox *service*, then you will need to register for a free account at https://mapbox.com/ and obtain a Mapbox Access token. This token should be provided either in `mapboxAccessToken` in `setPlotConfig` function, or as a variable that would be passed as an argument of `newPlot`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph appears to be the one from the JS docs... newPlot
isn't an R function and neither is setPlotConfig
so let's change it to match the behaviour of the R library please, including the two ways of setting the token :)
@@ -42,10 +33,6 @@ library(plotly) | |||
packageVersion('plotly') | |||
``` | |||
|
|||
### Mapbox Access Token | |||
|
|||
To plot on Mapbox maps with Plotly you "may" need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/r/mapbox-layers/) documentation for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these warning paragraphs should stay, even if the page doesn't include a map that requires a token, because some values of style
require one.
r/2017-02-27-scattermapbox.Rmd
Outdated
```{r} | ||
library(plotly) | ||
packageVersion('plotly') | ||
``` | ||
|
||
### Mapbox Access Token | ||
### Mapbox Access Tokens and When You Need Them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reference version of this paragraph should (and does?) live in the /r/mapbox-layers/
and should be linked to from here via the cut and paste "you may need a mapbox token" paragraph in some of the other pages.
CI is failing and there's a conflict atm |
I got CI to pass again and resolved the conflict. |
|
||
The word "mapbox" in the trace names and `layout.mapbox` refers to the Mapbox.js open-source library. If your basemap in `layout.mapbox.style` uses data from the Mapbox *service*, then you will need to register for a free account at https://mapbox.com/ and obtain a Mapbox Access token. This token should be provided either in `mapboxAccessToken` in `setPlotConfig` function, or as a variable that would be passed as an argument of `newPlot`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first two sentences here are important and were lost in the shuffle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-added.
r/2019-09-20-mapbox-layers.Rmd
Outdated
|
||
The map is composed of layers of three different types. | ||
<ol> | ||
<li> the `layout(mapbox(style))` call signature defines the lowest layers, also known as your "base map"</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this block needs to move back up above the "Mapbox Access Tokens and When You Need Them" because this is where we introduce style
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved back above.
r/2019-09-20-mapbox-layers.Rmd
Outdated
<ol> | ||
<li> the `layout(mapbox(style))` call signature defines the lowest layers, also known as your "base map"</li> | ||
<li> The various traces in the `plot_ly` call signature are by default rendered above the base map (this can be controlled via the use of `below` attribute).</li> | ||
<li> the `layout(mapbox(layers()))` call signature is an array that defines more layers that are by default rendered above the traces in `data` (although this can also be controlled via the `below` attribute).</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this usage of "call signature" doesn't make sense... A call signature is basically the name and layout of arguments you pass to a function, so you can't say it "is an array". You can say something like "when calling layout(mapbox(layers()))
you need to pass in an array" or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworded.
r/2019-09-20-mapbox-layers.Rmd
Outdated
|
||
Here is the same example, with in addition, a WMS layer from Environment Canada which displays near-real-time radar imagery in partly-transparent raster tiles, rendered above the `go.Scattermapbox` trace, as is the default: | ||
This example uses the same basemap as the one above. However, in this case, partly-transparent raster tiles are rendered above the trace as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change loses the explanation of what the top layer is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-added specifics about top layer.
OK let's ship this thing. 💃 |
closes plotly/documentation#1647
The purpose of this PR is to use a new mapbox token with URL restrictions. As a bonus, existing references to the key in version control have been removed for environment variables in CircleCI.