Select to view content in your preferred language

Loading feature layer from Portal for query not working

148
3
Wednesday
tad
by
Occasional Contributor

Hi all,

I'm trying to do a simple query on a feature layer from our Portal in my web application. I'm adding the data as a feature layer to do the query and I'm getting an error saying that the item does not exist or is inaccessible. The data are public so I shouldn't have to deal with OAuth or the user logging in. I tried using the portal id route:

const layer = new FeatureLayer({
     portalItem: {
          id: "*****************************"
     },
     outFields: ["*"]
});

and the url route:

var layer = new FeatureLayer("https://**********************************************/MapServer/0");

but neither seem to work. Any help would be appreciated...

0 Kudos
3 Replies
Noah-Sager
Esri Regular Contributor

If you can share a simplified reproducible test-app on some place like Codepen, that would make it a lot easier to diagnose. Also, the guide page in the query and filter tutorial should offer some good background information:

https://developers.arcgis.com/javascript/latest/query-filter/

 

0 Kudos
tad
by
Occasional Contributor

Not really simplified much, but here is a link to a CodePen. You have to click on Search->Water Right By File and click on the search button.

0 Kudos