Skip to main content

Activate Snapping on Layers

Comments

8 comments

  • Amanda Frech

    I think the main "gotcha" with snapping is that it isn't supported for sublayers of map services.  If you add a whole map service to your webmap (eg, from a URL that doesn't end in a layer ID, like https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer), it'll use that type of configuration and won't work with snapping.  "Feature layers" that were added to the webmap individually, or ones that come from a (...)/FeatureServer URL will support snapping. 

    I believe this is due to a limitations related to how different layers work in the Esri SDK. When you pan/zoom the map, map services are drawn using pictures exported from ArcGIS Server, without any feature geometry data being transmitted. For "feature layers" the map queries ArcGIS Server for feature data, and the query results are drawn by the browser.  That means the map always has the geometry data on-hand for those features and can easily access that information for snapping.

    We have an internal ticket (201507) to add documentation for supported layer types for snapping.  And there's an Idea post here that you could add a comment or vote to, if this is the limitation you're hitting: https://support.vertigis.com/hc/en-us/community/posts/11497444891794-Snapping-Improvement-Map-Image-Layer-format

    1
  • Brian Cunningham

    Hey Amanda Frech,

    After looking at the WebGIS Default viewer like you suggested earlier, I was able to figure out why snapping was not working in my maps even with feature layers being present.

    Inside of the command for my drawing tools, I did not have the following argument present:

    "pluginSettings": {
                    "snapping": true
                }

    That argument appears to be added by default now when a user adds the drawing tools to their map viewer, but since I added the drawing tools to my map viewer prior to snapping being available, I needed to add that argument in.

    So the entire command for my drawing tool needs to look like this:

    [
      {
        "name": "sketching.capture-geometry",
        "arguments": {
          "geometryType": "polygon",
          "pluginSettings": {
            "snapping": true
          }
        }
      },
      "drawing.create-graphics",
      "map.add-markup"
    ]

    The same argument needs to be present in the measuring tools as well in order for snapping to work while measuring.

    Thanks for pointing me in the direction of the default map viewer as a way to troubleshoot.

    Much appreciated,

    Brian

    1
  • Cam Barnard

    @Brian ... was just looking for that sample ... glad you found it.

    In hindsight perhaps we should have inserted that plug-in into existing configurations with an upgrade rule, but we are cautious about changing things customers have already configured. 

    0
  • Brian Cunningham

    Thanks Cam Barnard,

    Probably best to play it safe and leave it up to us to make the changes.

    Regards,

    Brian

    0
  • Andreas Broothaerts

    Hi, what would be the way to have the snapping activated for the geometry picker, I followed and read through the comments but can't seem to make it work. Is it the same way of working? 

    0
  • Brian Cunningham

    Hello Andreas Broothaerts ,

    That is a good question. I just checked one of my maps where I have a geometry picker inside of a workflow, and snapping does not work when I have snapping enabled in the map. I tried going in and editing the command that calls the workflow inside of Web Designer, but when I added the pluginSettings property, I was given an error stating that the pluginSettings property is not allowed.

    Amanda Frech  or Cam Barnard , do you all have any insight on this?

     

    Brian

    0
  • Cam Barnard

    It didn't initially work with Workflow geometry picker. We resolved this in 5.28 14-Feb-2024 with this issue
    “Resolved an issue preventing the Workflow geometry picker from using snapping when snapping was enabled. [240218]”

    0
  • Brian Cunningham

    Cam Barnard 

    Thanks for that information. We are currently on 5.27.

    Much appreciated,

    Brian

    0

Please sign in to leave a comment.