7

I have an Esri map loaded using the javascript api. I try to enable snapping, where a point should always snap to a given line.

I have a snap point symbol that will trace the line to snap to when I drag the edited point around. When I release the mouse, the edited point should snap to the line.

This works perfect on desktop, but when I try on iPhone 5 and HTC One, the snapping is not activated. The snap symbol is never shown when I drag the point, and it is not snapped when I release.

This is the code for how I enable the snapping:

map.enableSnapping({
    snapPointSymbol: snapSymbol,
    tolerance: 20000,
    alwaysSnap: true,
    layerInfos: [{ layer: map.graphics, snapToPoint: true, snapToVertex: true, snapToEdge: false}]
  });

Emulation testing:

When I try to emulate this in Chrome developer tools, I see the same problem for iOS devices, but not for Android or any other types of device. It seems like the ESRI code is sniffing the user agent string, and if it finds an iOS specific value in the user agent, the snapping is disabled.

Real device testing:

Reproduced on iPhone 5 (iOS 7) and HTC One.

How can I get snapping to work on mobile device?

  • 1
    This honestly sounds a bug that ESRI customer support should be able to help you with. – Senshi Feb 8 '18 at 11:14
2
+50

This is a documented bug:

Bug BUG-000086691 - The Snapping functionality in ArcGIS API for JavaScript version 3.13 does not work on iOS mobile devices.

You might want to contact Esri to see if and when they plan to fix this bug, since the bug status is 'In Product Plan'.

  • OK, this verifies that it does not work... What about a workaround? Is it possible to do some query that gets nearby features and do the "snapping" manually in some editor events? – awe Feb 9 '18 at 10:23
  • I don't know how to work around this, sorry. As I said, I would contact Esri support to get more info, since apparently the bug fix is 'in product plan' for more than 2 years. – GISGe Feb 9 '18 at 12:02
  • OK. I think I'll leave the bounty open for now in case someone else come up with a workaround. – awe Feb 9 '18 at 12:09
  • Sure, who knows :) – GISGe Feb 9 '18 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.