Hi,I added Point at center of polygon but failed to add point at center of line using geometry service.help me regarding thisThanks in advance
This might be related thread: http://forums.arcgis.com/threads/29061-How-to-find-the-midpoint-of-a-polyline.You can get the center of the polyline and add MapPoint in that location.
public static class GeometryExtension { public static MapPoint Center(this Polyline polyline) { var path = polyline.Paths[polyline.Paths.Count / 2]; int pointIndex = (path.Count-1)/2; MapPoint startPoint = path[pointIndex]; MapPoint endPoint = path[pointIndex + 1]; return new MapPoint((startPoint.X + endPoint.X)/2.0, (startPoint.Y + endPoint.Y)/2.0); } }
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.