在 html 中通过 arcgis online 访问 FeatureLayer

FeatureLayer access via arcgis online in html

请参阅下面的部分 html 代码,我的 featureLayer 保存在我的 arcgisonline;

var search = new Search({
        sources: [{
          featureLayer: new FeatureLayer("https://services1.arcgis.com/BZNs0xaSHDSi4V6G/arcgis/rest/services/postcodes/FeatureServer/0", 

当我 运行 代码时,它要求输入 arcgisonline 用户名和密码。 当我这样做时,它说用户名和密码不正确。

这是相同的用户名和密码,我本来可以直接在我的 ArcGIS 帐户中登录。

如有任何提示或建议,我们将不胜感激!

嗯,您可能打错了。

因为这是访问安全(非共享)层的唯一途径。在访问应用程序中的安全(非共享)层时,您必须输入 AGOL 凭据。

有其他方法可以避免 identity manager or Credentials 只需与大家分享 AGOL GIS feature layer

如下图所示。 (这些是您发布的图层)

我看不到其中的 "postcodes" 层。

这也可能是您未正确发布图层或图层未与任何人共享的原因。

希望对您有所帮助:)