- 自從: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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。