Disabling Snapping on Sketch does not prevent querying layer for extent causing massive database load

1130
8
02-01-2022 02:26 PM
RyderRoss
New Contributor II

When adding the Sketch widget to a map, the FeatureSnappingEngine fires off a request to query the extent of a private feature service of ours that has 140M records. This is happening even though we have all snapping features disabled in the config:

 

		this.sketch = new Sketch({
			view: this.view,
			layer: this.graphicsLayer,
			availableCreateTools: ["point", "polygon", "circle"],
			snappingOptions: {
				featureEnabled: false,
				enabled: false,
				selfEnabled: false,
			  },
			visibleElements: {
				createTools: { polyline: false },
				selectionTools: { "rectangle-selection": false, "lasso-selection": false },
				settingsMenu: false,
			},
			creationMode: "single",
			defaultUpdateOptions: {
				tool: "reshape"
			}
		});

 

The  request url looks like this:

 

https://example.com/arcgis/rest/services/PROD/ServiceName/MapServer/0/query?f=json&returnExtentOnly=true&returnCountOnly=true&outSR=102100&returnGeometry=false&spatialRel=esriSpatialRelIntersects&where=1%3D1&token=K2QQ07z....REDACTED....

 

I found someone else asking about snapping performance here: https://community.esri.com/t5/arcgis-api-for-javascript-questions/snapping-performance-issue-in-vers... They show a similar request being fired.

I believe this request ends up triggering a query on our postgres database that looks like this:

 

DECLARE sdecur_190_7264 BINARY CURSOR WITH HOLD FOR
  select  objectid,  st_asewkb(ST_setSRID(parcels_all.shape,-1)) AS shape,
  nlrgis.sde.parcels_all.GDB_GEOMATTR_DATA  from  nlrgis.sde.parcels_all  
where (( 1=1 )) and  ((sde.parcels_all.shape && 
public.ST_setSRID(public.ST_GeomFromEWKB($1),3857)) = 't')  

 

Since we have 140M records in our database, and it's querying with 1=1, it takes over a minute to complete. When we have just a couple users loading this map, the database server becomes overloaded and ArcGIS Server starts to timeout all requests. We're running ArcGIS Enterprise 10.9.1 and ArcGIS JS 4.22 if that helps.

Is there a way to prevent the query for the snapping extent from being requested?

 

 

 

 

 

Tags (2)
0 Kudos
8 Replies
RyderRoss
New Contributor II

I've also tried by creating SnappingOptions and a SketchViewModel by hand and it still does not prevent the query.

 

		const sketchViewModel = new SketchViewModel({
			view: this.view,
			layer: this.graphicsLayer,
			polygonSymbol: BasicMap.polygonSymbol,
			pointSymbol: BasicMap.pointSymbol,
			snappingOptions: new SnappingOptions({
				featureEnabled: false,
				enabled: false,
				selfEnabled: false,
			  }),
			defaultUpdateOptions: {
				tool: "reshape"
			}
		});

		this.sketch = new Sketch({
			viewModel: sketchViewModel,
			availableCreateTools: ["point", "polygon", "circle"],
			visibleElements: {
				createTools: { polyline: false },
				selectionTools: { "rectangle-selection": false, "lasso-selection": false },
				settingsMenu: false,
			},
			creationMode: "single",
		});
0 Kudos
JoseBanuelos
Esri Contributor

@RyderRoss ,

First of all, thank you for bringing this up to our attention. It seems this being caused by the SnappingControls widget. This issue doesn't present itself in Sketch until the SnappingControls widget was incorporated into Sketch. We are looking into this further, and will provide more information soon.

Thanks,

Jose

RyderRoss
New Contributor II

Thanks @JoseBanuelos

Let me know if there’s anything else I can share that would help. 

0 Kudos
RyderRoss
New Contributor II

Hi @JoseBanuelos 

 

Was wondering if you were able to look into this at all yet?

 

Thanks,

Ryder

0 Kudos
JoseBanuelos
Esri Contributor

@RyderRoss 
We have confirmed the issue to be a result of the SnappingControls widget. We have discussed the possible fixes for this, and are currently working on a solution. The target to get this fix is for version 4.24, so unfortunately it won't make it into the upcoming release 4.23. However, this is an issue we are prioritizing and should be in for 4.24.

Thanks,

Jose

MattReames2
New Contributor II

I was glad to find this response!  It's been application-breaking for me in 4.21, 4.22 and 4.23, so I am still using 4.20.   I was hoping it would be fixed in "4.24-next",  but that doesn't seem to be the case yet.

0 Kudos
RyderRoss
New Contributor II

@JoseBanuelos Just checking in to see if you think this will be in the 4.24 release. Thanks!

0 Kudos
JoseBanuelos
Esri Contributor

@RyderRoss ,
This is indeed resolved in 4.24! We improved snapping and went with a lazy-load approach to creating FeatureSnappingLayerSources. Therefore, there will not be any extent queries unless a user manually checks the layer on for snapping or programmatically sets it in the SnappingOptions.featureSources collection.

Please feel free to try it out and report any issues you find.

Thanks!

Jose

0 Kudos