Custom Parameters when Adding a WebService to a Map Viewer

2592
7
01-19-2023 11:21 AM
AdamRepsher_BentEar
Occasional Contributor

Hello All,

When setting up a Map Viewer, using the Add a Web Service tool, You can add Custom Parameters.

AdamRepsher_BentEar_0-1674153582689.png

The only information I can find on this feature is HERE.  Starting at step 4.  There is no other reference to what type of queries that will work here.

It is quite frustrating because there is no information on how to set up the Parameter or the Value.  It is not the same as just configuring a query in a service's ArcGIS REST Services Directory page.  For example, I fell into a discovery that you need a '/' AFTER the layer number (..../rest/services/folder/service_name/0/) when you enter the URL to get the custom parameter to work.

After that, it has been trial and error to figure out what will work here.  I have used this to limit the timespan like this:
Parameter: where 
Value: clock >= CURRENT_TIMESTAMP - INTERVAL '10' MINUTE 

Right now, I am trying to figure out how to return features within an envelope that I define.
geometry=-8415875.889,4309499.194,-8403034.469,4330137.192&geometryType=esriGeometryEnvelope&inSR=3857&spatialRel=esriSpatialRelIntersects

  • Do all of these types of queries work within the Custom Parameter layer settings in the new Map Viewer?
  • If so, where do we go to get help with configuring the parameter and value?

 

Thanks,

--Adam

7 Replies
LindsaySpencer
New Contributor III

Hi @AdamRepsher_BentEar ,

I'm having a similar issue, but with the geometry not being reflective of the parameter that was added. Only the table is actually performing the query, but the visualizations in the map have not changed to reflect the query results. In the image below, I have a parameter set on a service I pulled in, and it's a simple where clause, which is reflected in the 25 records shown in the table. However, there are WAY more than those 25 points on the map. It is a sea of blue.

LindsaySpencer_1-1680720480127.png

Anyone else experiencing a similar issue, and have you found a resolution?

Thanks!

Lindsay

0 Kudos
AdamRepsher_BentEar
Occasional Contributor

Hi Lindsay,

Most of the work I have done using custom parameters did not involve needing the map visualization.

Quick thought Did you add the custom parameters when you added the service to the map, or did you enter them after, in the 'Properties' section?  I remember that being an issue.  When I tried to enter them through the Properties section, I did not see any filtering.  I just don't remember if I looked at the table too,  (Funny, since I wasn't needing the map visualization, only the data...)

--Adam

0 Kudos
LindsaySpencer
New Contributor III

Hi @AdamRepsher_BentEar ,

So I added the 0 layer endpoint to the map, and then used the custom parameters in the properties section for the SQL. But I will give it a try the other way too, and see if that ends up making a difference!

Thanks!

0 Kudos
AshleyGahl
New Contributor III

Just in case you guys still have issues with parameterized map services | queries

I've also spent almost two days trying to figure this out!

What helped me was the following : loading your map service layer to the MapServer/9/query endpoint and then add your custom parameter name and value , e.g. where and suburb = 'Boksburg'

This will load your data parameterized query successfully

 

 

acarmody
New Contributor III

Hi @AdamRepsher_BentEar

I contacted Esri support asking the same question you posted here - I too am trying to spatially filter a web service using custom parameters.
Below is what Esri replied with - unfortunately it isn't as detailed as I'd hoped... Hope it helps you. I'm no closer to solving the spatial filter....

Typically, the requirement for custom parameters in a web service would be specified in the service’s documentation or API reference. However, not all services may provide this information explicitly.

In the context of ArcGIS Online, when you’re adding a layer from a web service, you have the option to add custom parameters. These parameters are appended to all requests made to the service. The parameters and their values would depend on the specific web service you’re working with.

If the service’s documentation does not provide the necessary details, you might need to contact the service provider or seek advice from relevant forums or communities.

In short, these custom parameters are generally used for accessing the service. You can however access other functionality by using URL parameters instead as found here: Use URL parameters in Map Viewer (esri.com) 

 

0 Kudos
AdamRepsher_BentEar
Occasional Contributor

To keep this going and to resolve one previous problem...

*** I did discover that if you enter the new parameters in the "properties" area, the query will succeed...
IF you then SAVE the webmap, and then RELOAD the entire page.  @LindsaySpencer - I know this is a long time since your post, but you should be able to find success with this.

Now - for the creation of the query, I am finding this link to be the best starting point for information on how to construct them:  Query (Map Service/Layer)—ArcGIS REST APIs | ArcGIS Developers
I hope it helps others!

--Adam

 

0 Kudos
acarmody
New Contributor III

Thank you for this tip regarding the properties section! I have my spatial filter working now.

For anyone who gets a bit lost finding this, here's a screenshot for reference.

Add layer from service url (don't add any parameters) > go to properties > add custom parameters 

acarmody_0-1711406062053.png

 

Format parameters - e.g.

acarmody_2-1711406884808.png

 

acarmody_1-1711406843184.png

 

acarmody_3-1711406986885.png

 

I've found that the minimum custom parameters to use are inSR and geometry. It seems that you don't need to include geometryType or spatialRel for the filter to work. outSR stops the filter from working.

The 'spatial inputs' section on the api explorer is handy for getting the geometry coordinates in the correct order - especially if you're working with data outside of the US/northern hemisphere https://hub.arcgis.com/datasets/b85233f0b21a4a9c9044ad21f459ed4a/api?layer=0

Cheers

0 Kudos