使用您自己的 3D 卡片渲染程序
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如果您无法将第三方渲染产品纳入您的解决方案,则可能需要创建自己的 3D Tiles 渲染器。此方法要求您考虑以下重要因素:
内容网址
在提供仿真 3D 图块时,Map Tiles API 会返回子数据集的 URI。这些图块集 URI 不是常规网址,仅包含路径和参数组成部分。它们不包含授权请求所需的 API 密钥。如需了解详情,请参阅 3D Tiles 规范。
请求和响应
以下是写实 3D 地图块请求和响应的一些示例。您可以使用 Chrome 开发者工具检查这些元素。
根 tileset 请求示例:
https://tile.googleapis.com/v1/3dtiles/root.json?key=YOUR_API_KEY
图块集响应 URI 示例:
/v1/3dtiles/datasets/CgA/files/UlRPVEYuYnVs.json?session=CIqhrPOFvdHSYg
渲染器使用的示例图块请求网址:
https://tile.googleapis.com/v1/3dtiles/datasets/CgA/files/UlRPVEYuYnVs.json?session=CIqhrPOFvdHSYg&key=YOUR_API_KEY
https://tile.googleapis.com/v1/3dtiles/datasets/CgA/files/UlRPVEYubm9k.glb?session=CIqhrPOFvdHSYg&key=YOUR_API_KEY
在构建后续图块请求时,您应附上图块集 URI 中显示的任何参数以及您的 API 密钥。3D Tiles API 提供以下两个参数:
session
- 3D 加载会话的内置标识符。它由 API 自动生成。在构建后续图块请求时,必须由渲染器附加。
key
- 您用于访问 3D 图块服务的 API 密钥。您必须将其附加到所有后续图块请求中。
显示提供方信息
版权归属是指确认地图图块的来源,这是使用此 API 的一项要求,其中包括 Google 品牌版权归属(徽标)以及数据版权归属。您可以在 Map Tiles API 政策页面上找到 Google 徽标。数据提供方信息会在每个图块响应中返回。在 asset
、copyright
下的 glTF 图块中查找。
{
"asset": {
"version": "2.0",
"generator": "draco_decoder",
"copyright": "Data SIO, NOAA, U.S. Navy, NGA, GEBCO;Landsat / Copernicus"
}
}
您必须在文本行中(通常在渲染底部)汇总、排序和显示此信息。这需要执行以下步骤:
从视图中的所有图块中提取所有版权信息。
使用英文分号分隔多个版权来源。
根据出现次数对信息进行排序。
在屏幕上显示版权来源,并按出现次数从多到少排序,类似于 Google 地球的做法。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eWhen building your own renderer for Photorealistic 3D Tiles, you need to handle content URLs, requests, and responses, and display attributions correctly.\u003c/p\u003e\n"],["\u003cp\u003eContent URLs for tilesets returned by the API are relative and require your API key to be added for subsequent requests.\u003c/p\u003e\n"],["\u003cp\u003eRequests for tiles must include both your API key and a session parameter provided in the initial tileset response.\u003c/p\u003e\n"],["\u003cp\u003eData attribution information is included in each tile's \u003ccode\u003easset.copyright\u003c/code\u003e property within the glTF and must be aggregated, sorted, and displayed appropriately in your application.\u003c/p\u003e\n"],["\u003cp\u003eYou are required to display both the Google logo and aggregated data attributions, similar to how Google Earth displays them, for compliance with API usage policies.\u003c/p\u003e\n"]]],[],null,["# Work with your own 3D Tiles renderer\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google\n| Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. [Learn more](/maps/comms/eea/faq). In addition, certain content from the Map Tiles API will no longer be returned. [Learn more](/maps/comms/eea/map-tiles).\n\nIf you're not able to incorporate a third-party rendering product into your\nsolution, then you might have to create your own 3D Tiles renderer. This\napproach requires that you consider the following important factors:\n\n- [Content URLs](#content_urls)\n- [Requests and responses](#requests-and-responses)\n- [Display data attributions](#display-attributions)\n\nContent URLs\n------------\n\nWhen serving Photorealistic 3D Tiles, the Map Tiles API returns URIs for\nchildren tilesets. These tileset URIs are not regular URLs. They include only\nthe path and parameters component. They don't contain your API key, which is\nrequired to authorize your request. For more information, see the\n[3D Tiles Specification](https://docs.opengeospatial.org/cs/18-053r2/18-053r2.html#23).\n\nRequests and responses\n----------------------\n\nHere are some examples of Photorealistic 3D Tiles requests and responses. You\ninspect them by using the Chrome Developer Tools.\n\nSample root tileset request: \n\n https://tile.googleapis.com/v1/3dtiles/root.json?key=YOUR_API_KEY\n\nSample tileset response URI: \n\n /v1/3dtiles/datasets/CgA/files/UlRPVEYuYnVs.json?session=CIqhrPOFvdHSYg\n\nSample tile request URLs used by renderers: \n\n https://tile.googleapis.com/v1/3dtiles/datasets/CgA/files/UlRPVEYuYnVs.json?session=CIqhrPOFvdHSYg&key=YOUR_API_KEY\n\n https://tile.googleapis.com/v1/3dtiles/datasets/CgA/files/UlRPVEYubm9k.glb?session=CIqhrPOFvdHSYg&key=YOUR_API_KEY\n\nYou should attach any parameters that appear in the tileset URI, together with\nyour API key, when you construct the subsequent tile requests. The 3D Tiles API\nprovides the following two parameters:\n\n`session`\n: A built-in identifier for a 3D loading session. It's automatically generated\n by the API. It must be attached by the renderer when constructing the subsequent\n tile requests.\n\n`key`\n: The API key that you used to access 3D Tiles service. You must attach it to\n all subsequent tile requests.\n\nDisplay attributions\n--------------------\n\nAttribution means acknowledging the source of map tiles and is a requirement for\nuse of this API - this includes the Google brand attribution (logo) as well as\ndata attribution. The Google logo is available to you on the\n[Map Tiles API Policies](/maps/documentation/tile/policies) page. Data\nattribution information is returned in every tile response. Look for it in the\n[glTF tile](https://github.com/KhronosGroup/glTF), under\n`asset`, `copyright`. \n\n {\n \"asset\": {\n \"version\": \"2.0\",\n \"generator\": \"draco_decoder\",\n \"copyright\": \"Data SIO, NOAA, U.S. Navy, NGA, GEBCO;Landsat / Copernicus\"\n }\n }\n\nYou must aggregate, sort, and display this information on a line of text,\nusually at the bottom of the rendering. This entails the following steps:\n\n1. Extract all of the copyright information from all of the tiles in view.\n\n2. Separate multiple copyright sources with a semicolon.\n\n3. Sort the information based on the number of occurrences.\n\n4. Display the copyright sources on-screen, ordered from most occurrences to the\n least, similar to the way\n [Google Earth](https://earth.google.com)\n does it."]]