We have used the Maps SDK for JavaScript to create a map app with the sketch tool widget on the map.
Once the user draws on the map using the sketch tool we are storing the geometry object into the database against a record in our system, so we can add the geometry back to map as a graphic when the record is viewed.
We are now looking to store the point for the drawing along with the geometry. We are looking for an equivalent function to PointOnSurface or Feature to Point conversion or centroid. Centroid calculation is not the ideal since that can result outside the geometry and can cause analysis on intersections to be inaccurate.
We want to be able to run this function on multi-part geometries as well.
Is there a method within the SDK or any other open source library, or REST API that can be used to achieve this?
Any resources and/or examples will be helpful.
Try the geometryService.labelPoints(...) method to see if it gives you what you need:
https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-geometryService.html#labelPo...