
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
This headless Node.js MapGL renderer generates styled raster tiles in an MBTiles format. It can work with a self-provided stylesheet and tile sources, or an online source with an optional overlay.
It uses https://www.npmjs.com/package/@maplibre/maplibre-gl-native to render tiles, https://www.npmjs.com/package/sharp to save them as an image, and Mapbox's https://www.npmjs.com/package/@mapbox/mbtiles to compile them into an mbtiles database.
The intention of this tool is to create offline background maps for use in mobile data collection applications such as https://mapeo.app/, ODK Collect, and KoboToolbox Collect.
This tool started as an extension of https://github.com/consbio/mbgl-renderer, which was built to export single static map images. Our thanks go out to the contributors of that project.
Node version: 18.17.0 to 20.x.x.
(Sharp requires 18.17.0 at minimum, and MapLibre Native is https://github.com/maplibre/maplibre-native/issues/1058, 20 being the latest)
To use these services, you are responsible for providing an API token as needed. You may also consult the terms of service and API limitations for each service below.
Please note that depending on your bounding box and maximum zoom level, this tool has the capability to send a lot of requests. You should first use a tool like the Mapbox offline tile count estimator to ensure that your request will be reasonable, and in the case of any sources with an API limit, won't end up costing you.
-s or --style: Are you providing your own style? If not, one will be generated using your sources. ("yes" or "no" answers only)Required options if style is "yes":
-l or --stylelocation: Location of your provided map style-i or --stylesources: Directory where any local source files (GeoJSON, XYZ directory, MBTiles) specified in your provided style are locatedRequired options if style is "no":
-O or --onlinesource: Specify an online source to be used as a background map (currently supported: "***g", "esri", "google", "mapbox", "mapbox-satellite", "planet-monthly-visual")-a or --overlay: Provide an GeoJSON object for a feature layer to overlay on top of the online source-k or --apikey: API key that may be required for your online source
If you selected "mapbox" for --onlinesource:-m or --mapboxstyle: The Mapbox style you want to use. Format: <yourusername>/<styleid>Additional options:
-b or --bounds: Bounding box in WSEN format, comma separated (required)-z or --minzoom: Minimum zoom level (0 if not provided)-Z or --maxzoom: Maximum zoom level (required)-o or --output: Name of the output mbtiles fileUsing a self-provided style:
bash$ node src/cli.js --style "yes" --stylelocation tests/fixtures/alert/style-with-geojson.json --bounds "-54.28772,3.11460,-54.03630,3.35025" -Z 13 --stylesources tests/fixtures/alert/sources
From an online source (***g):
bash$ node src/cli.js --style "no" --bounds "-54.28772,3.11460,-54.03630,3.35025" -Z 13 --onlinesource "bing" --apikey YOUR_API_KEY_HERE
From an online source (Mapbox):
bash$ node src/cli.js --style "no" --bounds "-54.28772,3.11460,-54.03630,3.35025" -Z 13 --onlinesource "mapbox-style" --mapboxstyle YOUR_USERNAME/YOUR_MAPBOX_STYLE_ID --apikey YOUR_API_KEY_HERE
From an online source (Planet):
bash$ node src/cli.js --style "no" --bounds "-54.28772,3.11460,-54.03630,3.35025" -Z 13 --onlinesource "planet-monthly-visual" --monthyear 2023-12 --apikey YOUR_API_KEY_HERE
Online source (Esri) with GeoJSON overlay:
bash$ node src/cli.js --style "no" --bounds "-54.28772,3.11460,-54.03630,3.35025" -Z 13 --onlinesource "esri" --apikey YOUR_API_KEY_HERE --overlay '{"type": "FeatureCollection", "name": "alert", "features": [{"geometry": {"coordinates": [[[-54.25348208981326, 3.140689896338671], [-54.25348208981326, 3.140600064810259], [-54.253841415926914, 3.140600064810259], [-54.25348208981326, 3.140689896338671]]], "geodesic": false, "type": "Polygon"}, "id": "-603946+34961", "properties": {"month_detec": "09", "year_detec": "2023"}, "type": "Feature"}]}'
To run with Docker simply run:
bashdocker run -it --rm -v "$(pwd)":/app/outputs communityfirst/mbgl-tile-renderer --style "no" --bounds "-54.28772,3.11460,-54.03630,3.35025" -Z 13 --onlinesource "mapbox-style" --mapboxstyle YOUR_USERNAME/YOUR_MAPBOX_STYLE_ID --apikey YOUR_API_KEY_HERE
This automatically pulls the latest image from Docker hub. The docker run command is used to execute the mbgl-tile-renderer tool with a set of options that define how the map tiles will be rendered and saved. Here's a breakdown of the command and its variables:
-it: This option ensures that the Docker container runs in interactive mode, allowing you to interact with the command-line interface.--rm: This option automatically removes the container when it exits, which helps to clean up and save disk space.-v "$(pwd)":/app/outputs: This mounts the current working directory ($(pwd)) to the /app/outputs directory inside the container, allowing the container to write the output files to your local file system.communityfirst/mbgl-tile-renderer: This is the name of the Docker image that contains the mbgl-tile-renderer tool.
Make sure to replace the placeholder values with your actual information before running the command.To run locally first build the Docker image:
bashdocker build -t mbgl-tile-renderer .
Then run:
docker run -it --rm -v "$(pwd)":/app/outputs mbgl-tile-renderer --style "no" --bounds "-54.28772,3.11460,-54.03630,3.35025" -Z 13 --onlinesource "mapbox-style" --mapboxstyle YOUR_USERNAME/YOUR_MAPBOX_STYLE_ID --apikey YOUR_API_KEY_HERE
Three easy ways to examine and inspect the mbtiles:
This tool makes it possible to download tiles from various API sources for offline usage. Here are links to the licensing and API limitations for each source:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务