PlacesQueryParameters

AMD: require(["geoscene/rest/support/PlacesQueryParameters"], (PlacesQueryParameters) => { /* code goes here */ });
ESM: import PlacesQueryParameters from "@geoscene/core/rest/support/PlacesQueryParameters.js";
类: geoscene/rest/support/PlacesQueryParameters
继承于:PlacesQueryParameters PlacesParameters Accessor
起始版本:GeoScene Maps SDK for JavaScript 4.27
beta

以下属性定义了 queryPlacesNearPoint()queryPlacesWithinExtent() 方法的参数,这些方法指向表示地点服务的 url。地点服务是一项随时可用的服务,可搜索世界各地的企业和地理位置。它允许您发现、定位和返回有关某个地方的详细信息。

另请参阅

构造函数

new PlacesQueryParameters(properties)
参数
properties Object
optional

有关可能传递给构造函数的所有属性的列表,请参见属性

属性概述

所有属性都可以设置、获取和监听。请参阅使用属性主题。
显示继承属性 隐藏继承属性
名称 类型 描述
String

用于访问资源或服务的授权字符串。

更多详情
PlacesParameters
String[]

将地点过滤为与类别 Id 相匹配的地点。

更多详情
PlacesQueryParameters
String

类的名称。

更多详情
Accessor
Extent

要在其中进行搜索的边界框的范围。

更多详情
PlacesQueryParameters
Number

从给定偏移量开始的请求结果。

更多详情
PlacesQueryParameters
Number

单个请求的响应中应发送的地点数。

更多详情
PlacesQueryParameters
Point

由 X 和 Y 坐标定义的位置。

更多详情
PlacesQueryParameters
Number

搜索地点的半径 (以米为单位),从提供的开始测量。

更多详情
PlacesQueryParameters
String

针对名称、类别等自由地搜索地点文本。

更多详情
PlacesQueryParameters
String

位置服务的 URL。

更多详情
PlacesParameters

属性详细信息

用于访问资源或服务的授权字符串。API 秘钥可在 GeoScene Developer 仪表盘中生成和管理。API 密钥显式绑定到 GeoScene 帐户;它还用于监视服务的使用情况。在特定类上设置细粒度 API 秘钥将覆盖全局 API 秘钥

另请参阅
categoryIds String[]

将地点过滤为与类别 Id 相匹配的地点。如果地点匹配任何类别 id,则返回该地点。如果未设置此属性,则将返回地点,无论其类别为何。

最多可以搜索 10 个类别 id。

另请参阅
declaredClass Stringreadonly inherited

类的名称。声明的类名称格式化为 geoscene.folder.className

extent Extent

要在其中进行搜索的边界框的范围。对于 queryPlacesWithinExtent() 方法,这是必需的

范围的总宽度必须小于 20,000 米,总高度也必须小于 20,000 米。

另请参阅
示例
require([
 "geoscene/rest/places",
 "geoscene/rest/support/PlacesQueryParameters",
 "geoscene/geometry/Extent"
], function(places, PlacesQueryParameters, Extent) {
   const extent = new Extent({
     xmin: 17.75,
     ymin: 59.55,
     xmax: 18,
     ymax: 59.7,
     spatialReference: 4326
   });

   const swedishPlacesQueryParameters = new PlacesQueryParameters({
      ,
     categoryIds: ["16000"], // Landmarks and Outdoors
     extent,
     offset: 2,
     searchText: "Värma"
   });

   function findPlaces() {
     places.queryPlacesWithinExtent(swedishPlacesQueryParameters).then(showPlaces);
   }

   function showPlaces(placesSolveResult) {
     // results from the queryPlacesWithinExtent() method
     console.log("PlacesQueryResult: ", placesSolveResult);
     // first PlaceResult object from PlacesQueryResult.results
     console.log("PlaceResult: ", placesSolveResult.results[0]);
   }

   findPlaces();
});
offset Number

从给定偏移量开始的请求结果。

此参数可与 pageSize 属性一起使用,以从后续页面获取结果。例如,当 pageSize = 2 时,将偏移量设置为 2 将返回第三个和第四个结果。不管分页如何,单个查询可以返回的最大地点数是 200

默认值:0
pageSize Number

单个请求的响应中应发送的地点数。

如需控制应用程序下载的响应大小,可将其设置为 20 以内的任何值。如果查询结果大于此页面大小,则响应对象将包含 next url 片段。此片段可用来形成一个请求 url,以获取下一页的结果。最多可返回 200 个地点。

默认值:10
point Point

由 X 和 Y 坐标定义的位置。对于 queryPlacesNearPoint() 方法,这是必需的

另请参阅
示例
require([
 "geoscene/rest/places",
 "geoscene/rest/support/PlacesQueryParameters"
], function(places, PlacesQueryParameters) {
   const point = {
     type: "point", // autocasts as new Point()
     longitude: 17.81840,
     latitude: 59.42145
   };

   const swedishPlacesQueryParameters = new PlacesQueryParameters({
      ,
     categoryIds: ["11077"], // Bathroom Contractor
     radius: 10000,  // set radius to 10,000 meters
     point,
     searchText: "Bygg",
     pageSize: 11
   });

   function findPlaces() {
     places.queryPlacesNearPoint(swedishPlacesQueryParameters).then(showPlaces);
   }

   function showPlaces(placesSolveResult) {
     // results from the queryPlacesNearPoint() method
     console.log("PlacesQueryResult: ", placesSolveResult);
     // first PlaceResult object from PlacesQueryResult.results
     console.log("PlaceResult: ", placesSolveResult.results[0]);
   }

   findPlaces();
});
radius Number

搜索地点的半径 (以米为单位),从提供的开始测量。此属性仅由 queryPlacesNearPoint() 方法使用。最大值为 10,000

默认值:1000
searchText String

针对名称、类别等自由地搜索地点文本。该值必须是字符串形式,长度范围为 3 ~ 255。

位置服务的 URL。地点服务是一项随时可用的服务,可搜索世界各地的企业和地理位置。它允许您发现、定位和返回有关某个地方的详细信息。

默认值:"https://places-api.geoscene.cn/geoscene/rest/services/places-service/v1"

方法概述

显示继承的方法 隐藏继承的方法
名称 返回值类值 描述

添加一个或多个与对象生命周期相关联的句柄

更多详情
Accessor
PlacesQueryParameters

创建调用此方法的 PlacesQueryParameters 实例的深度克隆。

更多详情
PlacesQueryParameters
Boolean

如果存在指定的句柄组,则返回 true。

更多详情
Accessor

移除对象拥有的句柄组。

更多详情
Accessor

方法详细说明

addHandles(handleOrHandles, groupKey)inherited

添加一个或多个与对象的生命周期相关联的句柄。当对象被销毁时,将移除句柄。

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
参数
handleOrHandles WatchHandle|WatchHandle[]

对象销毁后,标记为要移除的句柄。

groupKey *
optional

标识句柄应添加到的组的键。组中的所有句柄稍后都可使用 Accessor.removeHandles() 进行删除。如果未提供键,则句柄将被添加到默认组。

创建调用此方法的 PlacesQueryParameters 实例的深度克隆。

返回
类型 描述
PlacesQueryParameters 调用此方法的实例的克隆。
hasHandles(groupKey){Boolean}inherited

如果存在指定的句柄组,则返回 true。

参数
groupKey *
optional

组键。

返回
类型 描述
Boolean 如果存在指定的句柄组,则返回 true
示例
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
removeHandles(groupKey)inherited

移除对象拥有的句柄组。

参数
groupKey *
optional

要移除的组键或组键的数组或集合。

示例
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

您的浏览器不再受支持。请升级您的浏览器以获得最佳体验。