English中文

Geocoder

new Cesium.Geocoder(options)

用于查找地址和地标并将相机飞向它们的小部件。地理编码是使用 A widget for finding addresses and landmarks, and flying the camera to them. Geocoding is performed using Cesium ion.
名称 Name 类型 Type 说明 Description
options object 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
container Element | string 将包含小部件的 DOM 元素或 ID。 The DOM element or ID that will contain the widget.
scene Scene 要使用的场景实例。 The Scene instance to use.
geocoderServices Array.<GeocoderService> 可选 optional 要使用的地理编码器服务 The geocoder services to be used
autoComplete boolean true 可选 optional 如果地理编码器应在用户键入自动完成时进行查询,则为 true True if the geocoder should query as the user types to autocomplete
flightDuration number 1.5 可选 optional 摄像机飞行到输入位置的持续时间(以秒为单位)。 The duration of the camera flight to an entered location, in seconds.
destinationFound Geocoder.DestinationFoundFunction GeocoderViewModel.flyToDestination 可选 optional 成功地理编码后调用的回调函数。如果未提供,默认行为是将相机飞行到结果目的地。 A callback function that is called after a successful geocode. If not supplied, the default behavior is to fly the camera to the result destination.

成员 Members

获取父容器。 Gets the parent container.

searchSuggestionsContainer : Element

获取父容器。 Gets the parent container.
获取视图模型。 Gets the view model.

方法 Methods

销毁小部件。如果从布局中永久删除小部件,则应调用。 Destroys the widget. Should be called if permanently removing the widget from layout.

isDestroyed()boolean

返回: Returns:
如果对象已被销毁,则为 true,否则为 false。 true if the object has been destroyed, false otherwise.

类型定义 Type Definitions

Cesium.Geocoder.DestinationFoundFunction(viewModel, destination)

处理成功地理编码结果的函数。 A function that handles the result of a successful geocode.
名称 Name 类型 Type 说明 Description
viewModel GeocoderViewModel 视图模型。 The view model.
destination Cartesian3 | Rectangle 地理编码的目标结果。 The destination result of the geocode.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.