在 Geospatial Creator 中搜索地图注点(Unity 版)
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Geospatial Creator 使用纬度和经度坐标来预览仿真 3D 图块。借助 Google Places API,您可以通过文本搜索来搜索实际位置,并在预览中使用其位置。
本文档假定您熟悉 Geospatial Creator for Unity。如果您刚开始接触 Geospatial Creator,请先参阅我们的入门指南,然后再继续。
Geospatial Creator Search 由 Google Places API 提供支持。此服务可以将地点名称(如东京、旧金山)或地址(如唐宁街 10 号、SW1A 2AA)转换为地理纬度和经度坐标。这些坐标可用于放置对象或将 AR 场景的原点移动到特定位置。
您需要配置 API 密钥才能使用 Places API。API 密钥必须与您用于 Map Tiles API 的密钥相同。您可以在 Geospatial Creator Origin 的“Inspector”面板中查看此键。
要设置用于搜索的 API 密钥,请执行以下操作:
- 如需启用 Places API,请参阅 Google Cloud 控制台中的 Places API 页面。
- 如需将现有的 API 密钥配置为使用 Places API,请访问 Google Cloud 控制台中的“凭据”页面。
如果您没有看到现有的 Map Tiles API 密钥,请确保您查看的是正确的 Google Cloud 项目。
使用“搜索”功能更改出发地
配置 API 密钥后,您可以使用“搜索”功能更改 Geospatial Creator Origin。在“Scene Hierarchy”(场景层次结构)中突出显示 Geospatial Creator Origin,然后点击“Inspector”面板上的“Search for Location”按钮:

如果您的场景中还没有出发地,您可以从 GameObjects > XR 菜单中添加一个。
“搜索”对话框打开后,在“搜索地点”框中输入搜索字词,然后按 Enter 键。“地点”下拉菜单中会填充相关结果。例如,如果您输入“Google Mountain View”,列表会包含位于加利福尼亚州山景城的 Google 总部的地址:

选择最相关的结果。Scene View 相机会移至所选位置上方的某个位置。点击“应用至对象”,将此搜索结果的经纬度分配给您的出发地。
请注意,Origin 是参考点,用于确定 Geospatial Creator 锚点在 Unity 世界坐标中所处的位置。当您移动原点时,系统会更新与该原点关联的所有锚点的纬度和经度,以保持它们在 Unity 世界坐标中相对于原点的位置。如果您想在原点附近以特定方式排列锚点,此方法会非常有用。
使用搜索更改锚点位置
您还可以使用搜索功能更改地理空间锚点的位置,而不考虑出发地。与使用“搜索出发地”类似,在场景层次结构中选择锚点并点击“搜索位置”按钮。此对话框与源站搜索几乎完全相同。在“搜索地点”框中输入搜索字词,然后按 Enter 键。您现在可以使用“地点”下拉列表中的结果重新分配锚点纬度和经度。请注意,您可能需要手动调整锚点的海拔。
您还可以在场景层次结构中多选锚点,然后使用搜索功能同时向一个搜索结果分配多个锚点。“搜索”对话框中的“所选对象”列表包含要移动的所有锚点的名称。
已知缺点 / 问题
- 目前不支持为 Places API 和 Map Tiles API 分别使用密钥;您必须对它们使用相同的密钥。
- Geospatial Creator Origin 必须具有 Cesium 地理参考组件,Google 搜索才能正常运行。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-01。
[null,null,["最后更新时间 (UTC):2023-12-01。"],[[["\u003cp\u003eGeospatial Creator uses latitude and longitude coordinates, powered by the Google Places API, to preview photorealistic 3D tiles of real-world locations.\u003c/p\u003e\n"],["\u003cp\u003eYou need to configure your existing Google Maps API key to enable the Places API, allowing the conversion of place names and addresses into geographic coordinates for AR scene placement.\u003c/p\u003e\n"],["\u003cp\u003eThe “Search for Location” feature enables you to change the location of your Geospatial Creator Origin and individual or multiple Geospatial Anchors.\u003c/p\u003e\n"],["\u003cp\u003eMoving the Origin updates the latitude and longitude of all associated anchors, maintaining their relative positions for specific anchor arrangements.\u003c/p\u003e\n"],["\u003cp\u003eCurrently, the Places API and Map Tiles API require the same API key, and a Geospatial Creator Origin needs a Cesium Georeference component for search functionality.\u003c/p\u003e\n"]]],[],null,["# Search for points of interest in Geospatial Creator for Unity\n\nGeospatial Creator uses latitude and longitude coordinates to preview\nphotorealistic 3D tiles. You can use a text search to search for real-world\nlocations and use its location in the preview using the Google Places API.\n\nThis document assumes you are familiar with Geospatial Creator for Unity. If you\nare new to Geospatial Creator, check out our [Getting\nStarted](/ar/geospatialcreator/unity/quickstart) guide before continuing.\n\nConfigure your Places API Key\n-----------------------------\n\nGeospatial Creator Search is powered by the [Google Places\nAPI](https://developers.google.com/maps/documentation/places/web-service/overview).\nThis service can convert place names like Tokyo, San Francisco, or addresses\nlike 10 Downing Street, SW1A 2AA, into geographic latitude and longitude\ncoordinates. These coordinates can be used to place objects or move the origin\nof your AR scene to a specific location.\n\nYou need to configure your API key to use the Places API. The API key must be\nthe same one you use for the Map Tiles API. You can check this key on the\nInspector panel for your Geospatial Creator Origin.\n\nTo set up the API key for search, do the following:\n\n1. To enable the Places API, see the [Places API page](https://console.cloud.google.com/apis/library/places-backend.googleapis.com) in your Google Cloud Console.\n2. To configure your existing API key to use the Places API, visit the [Credentials page](https://console.cloud.google.com/apis/credentials) in your Google Cloud Console.\n\nIf you don't see your existing Map Tiles API key, make sure you are looking at\nthe correct Google Cloud Project.\n\nChange the Origin location using Search\n---------------------------------------\n\nAfter you have configured your API key, you can use Search to change your\nGeospatial Creator Origin. Highlight your Geospatial Creator Origin in the Scene\nHierarchy, and then click the \"Search for Location\" button on the Inspector\npanel:\n\nIf you don't have an existing origin in your scene, you can add one from the\n**GameObjects \\\u003e XR** menu.\n\nWhen the Search dialog opens, enter your search term into the \"Search Place\"\nbox and press Enter. The \"Places\" drop down populates with relevant\nresults. For example, if you type in \"Google Mountain View\", the list includes\naddresses for Google Headquarters in Mountain View, CA:\n\nSelect the most relevant result. The Scene View camera will move to a position\nabove the selected location. Click \"Apply to Objects\" to assign the latitude and\nlongitude of this search result to your Origin.\n\nRemember, the Origin is the reference point that determines where your\nGeospatial Creator Anchors are in Unity world coordinates. When you move the\nOrigin, the latitude and longitude of all anchors associated with that origin\nare updated to maintain their relative position to the Origin in Unity world\ncoordinates. This is useful if you want a specific arrangement of anchors in the\nvicinity of an origin.\n\nChange Anchor locations using Search\n------------------------------------\n\nYou can also use the Search feature to change the location of a Geospatial\nAnchor, independently of the Origin. Similar to using Search for an Origin,\nselect the anchor in the Scene Hierarchy and click the \"Search for Location\"\nbutton. This dialog is nearly identical to the origin search. Type your search\nterm in the \"Search Place\" box, and press Enter. You can now reassign the\nAnchor latitude and longitude using the results in the \"Places\" drop down list.\nNote that you may need to manually adjust the altitude of the anchor.\n\nYou can also multi-select Anchors in the Scene Hierarchy, and then use the\nSearch feature to assign multiple anchors to a search result simultaneously. The\n\"Selected Objects\" list in the Search Dialog includes the names of all anchors\nto be moved.\n\nKnown Shortcomings / Issues\n---------------------------\n\n- Separate keys for the Places API and Map Tiles API are not supported at this time; you must use the same key for each.\n- A Geospatial Creator Origin must have a Cesium Georeference component for Search to work."]]