有没有办法将 mapBox 地图从网络导出为 PDF、PNG?

Is there anyway to export mapBox map to PDF, PNG from web?

我们正在使用 MapBox api 在网络中显示地图。我们想将地图导出为 PDF 或 PNG,包括来自网络的 GeoJSON 数据。有什么办法吗?

您可以为此使用静态图像 API,但需要您通过 Mapbox 将 GeoJSON 添加到您的地图中:

Static maps are standalone images that can be displayed on web and mobile devices without the aid of a mapping library or API. A static map image uses the Mapbox {mapid} and looks like an embedded map without any interactivity or controls.

https://www.mapbox.com/developers/api/static/

如果这不是一个选项,您可以查看 Leaflet.Image 插件:

Export images out of Leaflet maps without a server component, by using Canvas and CORS.

https://github.com/mapbox/leaflet-image