I would like the ability to perform a feature search/zoom into a feature class using URL Parameters and ArcGIS Online. The syntax looks to be simple, but I can not get it to work for my feature and web map. An example of what I am trying to perform is found in this link
Use URL parameters to modify embedded maps—ArcGIS Online Help | ArcGIS
I have created a feature class in ArcGIS Desktop, and have uploaded it with Desktop to my organizations' ArcGIS Online account as a feature service. I have created the web map using ArcGIS Online. I also have enabled the find locations by layer as well.
My webmap and data is not public information, so sharing the URL would not work, but here's an example of what I am trying to search and zoom to on the map.
Feature: OilGas
Attribute: Name
Name: 10005
If I follow the samples, the end of my url should be &feature=OilGas;Name;10005
This does not seem to work. My map shows up, but it will not zoom to the feature. Is my syntax wrong? Does the map need to publicly shared, or do I need ArcGIS Server? Currently it is not shared other then my organization. We do not have server. And I am not sure why the syntax in the URL is wrong.
I would be most appreciate of any suggestions/help in this manner
The tricky part of setting up the url search is finding the correct value for the layer name. The easiest way to do this would be to use the Minimalist Configurable app available in the ArcGIS Online template gallery. The Minimalist app is the exact same app we use in the Embed option but it allows you to configure a few additional settings like the url parameter search. If you configure the app this way then you'll get a configured app url that you can then use to embed into your site. Here's an example:
The second option is to inspect your web map json to get the proper id for the layer you want to search. You can see the web map json by viewing your web map in ArcGIS Online with the browser developer tools open to the network tab. Each browser provides dev tools - here's a link that explains how to open the ones available with Chrome.
Chrome DevTools | Web Tools - Google Developers
With the dev tools open to the network tab I type data in the 'Filter' text box and then click on the XHR option to filter the requests that appear and then reload the map. When you do this you should see something like the screenshot below where there are a few requests.
If you click on the request with the id that is equal to your web map id then click the response tab you'll see the web map json. To view it full size right-click the request in the request list and choose the 'Open Link in new Tab' option. Then look through the available operational layers to find the one you want to use in your url search. Here's an example of the json for my web map and if I wanted to use the Public Trails layer I'd specify PUBLIC_TRAILS_REDLANDS_7252 as the layer id.
Thank you very much. The dev tools worked like a charm, and I found the last four digits. The map worked as planned. Thanks again.Kelly Hutchins