I have an app in AppStudio that contains a map with several feature layers. The user for the application will be interacting with the layers and submitting data from app to elsewhere. I want the user to be able to click on the map (it will never be exact, therefore reasonably close) near a line feature and retrieve the coordinates for the nearest point on the line.
For example, user clicks on or near the polyline feature. This creates a Graphic that is snapped to the nearest point on the polyline feature. This allows the app to retrieve coordinates where the user tapped on the feature.
This is the workflow I would like to implement:
1) User clicks on or near polyline feature
2) Get the coordinates for the point that user tapped on and calculate distance x to polyline feature (using Geometry Engine's distance method).
3) Plot point on line that is x distance away from tapped point to line feature.
4) Place a Graphic on this final point on the line feature to indicate that the snapping has completed.
How can I achieve step 3? I have a distance that I can calculate successfully. Is the best way to do this by calculating a buffer with x radius and then finding points of intersection with the line feature? Or is there a better way? All I want to do is just snap this point that is not on the line to the line.
Thanks for the help!
--------------------------------------------------
Application Developer, GeoMarvel