嘿,大家都在尝试使用 fetchResources 函数检索门户项目中的所有资源,但它返回了
nextStart : -1
resources: []
total: 0
虽然门户项目里有资源 我做错了什么?
const item = new PortalItem({
id: "0890f410a5314b448528f059e3083261",
portal
});
await item.load();
console.log(item.fetchResources());
这些“表”不是 ArcGIS 门户项目上下文中的“资源”。项目的具体资源取决于项目类型。请参阅示例 https://developers.arcgis.com/rest/users-groups-and-items/item-resources.htm
如果您尝试获取这些表中的数据,您可能需要创建指向这些表的要素图层(也称为非空间图层)。
您使用 fetchResources 的方式是错误的。对于异步方法,您需要使用await
const resourcesResponse = await item.fetchResources();
const resources = resourcesResponse.resources;
console.log(resources);