查询与要素关联的附件信息。如果图层的 capabilities.data.supportsAttachment 属性为
false
,它将返回错误。如果图层的 capabilities.operations.supportsQueryAttachments 为true
,则可以查询多个要素的附件。已知限制
当图层的 capabilities.operations.supportsQueryAttachments 属性为
false
时,AttachmentQuery.objectIds 属性仅接受单个objectId
。参数:
类型 说明 attachmentQuery AttachmentQuery autocast来自 Object指定查询的附件参数。
options Object可选的 具有以下属性的对象。
规格:signal可选的 可用于中止异步任务的信号对象。当发出中止信号时,返回的 Promise 将被名为
AbortError
的 Error 拒绝。另请参阅AbortController,了解有关如何构建可用于传递中止信号的控制器的更多信息。返回:
类型 说明 Promise<Object> 解析后,返回包含按源要素 objectIds 分组的 AttachmentInfos 的对象。 例子:
featureLayer.when(function () { // queryObjectIds for all features within the layer featureLayer.queryObjectIds().then(function (objectIds) { // Define parameters for querying attachments, // query features where objectIds are less than 735, // and only query jpeg attachments for these features. let attachmentQuery = { objectIds: objectIds, definitionExpression: "OBJECTID < 735", attachmentTypes: ["image/jpeg"] }; // Only pass in one objectId for attachmentQuery.objectIds // if the layer's capabilities.operations.supportsQueryAttachments is false featureLayer.queryAttachments(attachmentQuery).then(function (attachments) { // Print out all returned attachment infos to the console. attachmentQuery.objectIds.forEach(function (objectId) { if (attachments[objectId]) { let attachment = attachments[objectId]; console.group("attachment for", objectId); attachment.forEach(function (item) { console.log("attachment id", item.id); console.log("content type", item.contentType); console.log("name", item.name); console.log("size", item.size); console.log("url", item.url); console.groupEnd(); }); } }); }) .catch(function (error) { console.log("attachment query error", error); }) }); });
基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/layers/SubtypeGroupLayer"], (SubtypeGroupLayer) => { /* code goes here */ });
ESM:
import SubtypeGroupLayer from "@arcgis/core/layers/SubtypeGroupLayer";
类:
esri/layers/SubtypeGroupLayer
继承: SubtypeGroupLayer > Layer > Accessor
自从:用于 JavaScript 4.20 的 ArcGIS API
用法说明
SubtypeGroupLayer.queryAttachments
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS SubtypeGroupLayer.queryFeatureCount用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.queryExtent用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.queryObjectIds用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.queryFeatures用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.on用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.sublayers用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.timeOffset用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.fields用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.maxScale用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.layerId用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.timeExtent用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.objectIdField用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.fieldsIndex用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.getFieldDomain用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.visible用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.refreshInterval用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.createQuery用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.fullExtent用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.when用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.addAttachment用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.effect用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.formTemplate用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.definitionExpression用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.version用法及代码示例
- JavaScript ArcGIS SubtypeGroupLayer.opacity用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 SubtypeGroupLayer.queryAttachments。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。