使用 folium 使 tile-ID 请求 URL 与 mapbox-style "satellite-streets" 一起工作
Make tile-ID request URL work with mapbox-style "satellite-streets" using folium
我使用 Python
在地图上绘制地理空间数据。
对于某些地图样式,例如 ["basic", "streets", "outdoors", "light", "dark", "satellite", "satellite-streets"]
,我需要一个 mapbox 访问令牌,对于某些 地理空间绘图包 ,例如 folium
,我什至需要创建自己的link 用于检索地图图块。
到目前为止,它与样式 "satellite"
:
配合得很好
mapbox_style = "satellite"
mapbox_access_token = "....blabla"
request_link = f"https://api.mapbox.com/v4/mapbox.{mapbox_style}/{{z}}/{{x}}/{{y}}@2x.jpg90?access_token={mapbox_access_token}"
However, when choosing "satellite-streets"
as mapbox-tile-ID, the output doesn't show a background map anymore.将 "satellite-streets", "satellitestreets" and "satellite_streets"
插入上述 link-string.
失败
为什么会这样,我怎样才能知道 "satellite-streets"
的正确图块 ID 名称是什么?
我在联系客户支持时找到了答案。
显然,必须访问其网站上列出的特定名称的静态 API:
"In general, the styles that you mentioned including
"satellite_streets" that you are referencing are our classic styles
that are going to be deprecated starting June 1st. I would recommend
using our modern static API the equivalent modern styles. This
will allow you to see the most updated street data as well.
Like the example request below:
https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/1/1/0?access_token={your_token}
Here is more info on the deprecation of the classic styles and
the migration guide for them."
我自己尝试了一切之后的个人改编是:
通过将上述内容与有关如何在 this documention from mapbox' website 上构建 Mapbox 请求 link 的详细信息相结合,
我终于成功了。
示例请求如下所示(在 python 中使用 f 字符串):
mapbox_tile_URL = f"https://api.mapbox.com/styles/v1/mapbox/{tileset_ID_str}/tiles/{tilesize_pixels}/{{z}}/{{x}}/{{y}}@2x?access_token={mapbox_access_token}"
tileset_ID_str 可以是例如"satellite-streets-v11"
可以在下面link containing valid static maps.
看到
我使用 Python
在地图上绘制地理空间数据。
对于某些地图样式,例如 ["basic", "streets", "outdoors", "light", "dark", "satellite", "satellite-streets"]
,我需要一个 mapbox 访问令牌,对于某些 地理空间绘图包 ,例如 folium
,我什至需要创建自己的link 用于检索地图图块。
到目前为止,它与样式 "satellite"
:
mapbox_style = "satellite"
mapbox_access_token = "....blabla"
request_link = f"https://api.mapbox.com/v4/mapbox.{mapbox_style}/{{z}}/{{x}}/{{y}}@2x.jpg90?access_token={mapbox_access_token}"
However, when choosing "satellite-streets"
as mapbox-tile-ID, the output doesn't show a background map anymore.将 "satellite-streets", "satellitestreets" and "satellite_streets"
插入上述 link-string.
为什么会这样,我怎样才能知道 "satellite-streets"
的正确图块 ID 名称是什么?
我在联系客户支持时找到了答案。 显然,必须访问其网站上列出的特定名称的静态 API:
"In general, the styles that you mentioned including "satellite_streets" that you are referencing are our classic styles that are going to be deprecated starting June 1st. I would recommend using our modern static API the equivalent modern styles. This will allow you to see the most updated street data as well.
Like the example request below:
https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/1/1/0?access_token={your_token}
Here is more info on the deprecation of the classic styles and the migration guide for them."
我自己尝试了一切之后的个人改编是:
通过将上述内容与有关如何在 this documention from mapbox' website 上构建 Mapbox 请求 link 的详细信息相结合, 我终于成功了。
示例请求如下所示(在 python 中使用 f 字符串):
mapbox_tile_URL = f"https://api.mapbox.com/styles/v1/mapbox/{tileset_ID_str}/tiles/{tilesize_pixels}/{{z}}/{{x}}/{{y}}@2x?access_token={mapbox_access_token}"
tileset_ID_str 可以是例如"satellite-streets-v11"
可以在下面link containing valid static maps.