How to query the portal for layers within a specific geometry?

1461
2
Jump to solution
01-17-2017 09:11 AM
JonathanBailey
Occasional Contributor III
Portal.queryItems(queryParams?)

can be used to query the portal for items. However, there doesn't appear to be a a way to query for items within a specific search geometry (such as within a map extent). The PortalItems that are returned can be examined to determine if their extents intersect the search geometry (requiring an additional call to the GeometryService). 

This seems like something that should be possible, as evidenced by the fact that you can do it from within the ArcGIS Online map viewer. Is it possible?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hey Jonathan, 

Are you using 3.x? If so you should be able to specify bbox property in queryParams. I have not tested it but it should work. Here a link to REST API doc for search: ArcGIS REST API 

if you are using 4.x then you can specify PortalQueryParams.extent: PortalQueryParams | API Reference | ArcGIS API for JavaScript 4.2 

Hope this helps

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

Hey Jonathan, 

Are you using 3.x? If so you should be able to specify bbox property in queryParams. I have not tested it but it should work. Here a link to REST API doc for search: ArcGIS REST API 

if you are using 4.x then you can specify PortalQueryParams.extent: PortalQueryParams | API Reference | ArcGIS API for JavaScript 4.2 

Hope this helps

JonathanBailey
Occasional Contributor III

Hi Undral,

I'm using the 3.19 version of the JavaScript API. I was looking at the documentation here:

Portal | API Reference | ArcGIS API for JavaScript 3.19 

This documentation doesn't indicate any reference to the bbox parameter. But, as you suggested, I tried adding a bbox parameter to my query parameters, and it worked! Strange that this isn't included in the JavaScript API documentation.

Thanks!

0 Kudos