- 自从:ArcGIS 适用于 JavaScript 4.9 的 API
查询与要素关联的附件信息。如果图层的 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/FeatureLayer"], (FeatureLayer) => { /* code goes here */ });
ESM:
import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
类:
esri/layers/FeatureLayer
继承: FeatureLayer > Layer > Accessor
自从:用于 JavaScript 4.0 的 ArcGIS API
用法说明
FeatureLayer.queryAttachments
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS FeatureLayer.queryExtent用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryFeatureCount用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryRelatedFeatures用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryRelatedFeaturesCount用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryTopObjectIds用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryTopFeatureCount用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryTopFeaturesExtent用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryTopFeatures用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryObjectIds用法及代码示例
- JavaScript ArcGIS FeatureLayer.queryFeatures用法及代码示例
- JavaScript ArcGIS FeatureLayer.when用法及代码示例
- JavaScript ArcGIS FeatureLayer.getFieldDomain用法及代码示例
- JavaScript ArcGIS FeatureLayer.formTemplate用法及代码示例
- JavaScript ArcGIS FeatureLayer.relationships用法及代码示例
- JavaScript ArcGIS FeatureLayer.objectIdField用法及代码示例
- JavaScript ArcGIS FeatureLayer.opacity用法及代码示例
- JavaScript ArcGIS FeatureLayer.datesInUnknownTimezone用法及代码示例
- JavaScript ArcGIS FeatureLayer.featureEffect用法及代码示例
- JavaScript ArcGIS FeatureLayer.timeInfo用法及代码示例
- JavaScript ArcGIS FeatureLayer.createQuery用法及代码示例
- JavaScript ArcGIS FeatureLayer.outFields用法及代码示例
- JavaScript ArcGIS FeatureLayer.version用法及代码示例
- JavaScript ArcGIS FeatureLayer.fullExtent用法及代码示例
- JavaScript ArcGIS FeatureLayer.visible用法及代码示例
- JavaScript ArcGIS FeatureLayer.labelingInfo用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 FeatureLayer.queryAttachments。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。