TransWikia.com

Increasing click selection tolerance in ArcGIS Online

Geographic Information Systems Asked by sirgeo on April 20, 2021

Will the 2016 solution listed at Increase FeatureLayer click tolerance work in Web App Builder (ArcGIS Online) or perhaps a newer solution exists?

We have valid feedback:

I am having a little trouble finding the right place to click to get
the info box to pop up on some projects. Can you add a selection
feature to make that easier?

Please see attached syntax error I am seeing when attempting to use the suggested code in AGOL’s (within WAB) Configure Popups (does a JS to Arcade converter exist?) and the code copy / paste below.

In 3.x, you can do this by overriding the "_calculateClickTolerance" function of the map’s popupManager property. For example:

map.popupManager._calculateClickTolerance = function(graphicsLayers) {
    return 10;};

That is a very simplistic example, but you could implement whatever logic you want inside that function as long as you return an integer (preferably non-negative).

In ArcGIS Desktop

under Selection -> Selection Options -> Selection tolerance

exists and wondering where the similar option is in AGOL (WAB) for configure popups.

I’ve read through Your Arcade Questions Answered but have not found a solution yet.

One Answer

dojo.connect(map,"onClick",function(evt){ 
      var query = new esri.tasks.Query(); 
      query.geometry = pointToExtent(map,evt.mapPoint,10); 


function pointToExtent(map, point, toleranceInPixel) { 
   var pixelWidth = map.extent.getWidth() / map.width; 
   var toleraceInMapCoords = toleranceInPixel * pixelWidth; 
   return new esri.geometry.Extent( point.x - toleraceInMapCoords, 
                point.y - toleraceInMapCoords, 
                point.x + toleraceInMapCoords, 
                point.y + toleraceInMapCoords, 
                map.spatialReference );                            
  }
  • The code is used to build a web application using JSAPI 4.2
  • Instead of passing in the map instance, pass it in the map view
  • The code was originally for the 3.x API
  • Works well with a tolerance of 15

Answered by Yogesh Chavan on April 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP