<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Adding point graphic at center of line feature using geometry service in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181443#M4522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You might calculate the center of the polyline at the client side.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Very simplified version:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;public static class GeometryExtension
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static MapPoint Center(this Polyline polyline)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var path = polyline.Paths[polyline.Paths.Count / 2];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int pointIndex = (path.Count-1)/2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MapPoint startPoint = path[pointIndex];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MapPoint endPoint = path[pointIndex + 1];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new MapPoint((startPoint.X + endPoint.X)/2.0, (startPoint.Y + endPoint.Y)/2.0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:black;"&gt;Then you can get the center of a polyline by : MapPoint center= myPolyline.Center();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is just returning the center of the middle segment but you might enhance the code depending on what you need exactly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 09:16:20 GMT</pubDate>
    <dc:creator>DominiqueBroux</dc:creator>
    <dc:date>2021-12-11T09:16:20Z</dc:date>
    <item>
      <title>Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181435#M4514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added Point at center of polygon but failed to add point at center of line using geometry service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;help me regarding this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 May 2011 19:32:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181435#M4514</guid>
      <dc:creator>ImtiyazPasha1</dc:creator>
      <dc:date>2011-05-22T19:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181436#M4515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I added Point at center of polygon but failed to add point at center of line using geometry service.&lt;BR /&gt;&lt;BR /&gt;help me regarding this&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think it only works for polygons&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 May 2011 12:09:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181436#M4515</guid>
      <dc:creator>IgressT</dc:creator>
      <dc:date>2011-05-23T12:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181437#M4516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There should be any option to draw point graphic at center of line using geometry service or without using geometry service please help...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 May 2011 16:17:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181437#M4516</guid>
      <dc:creator>ImtiyazPasha1</dc:creator>
      <dc:date>2011-05-23T16:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181438#M4517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This might be related thread: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/29061-How-to-find-the-midpoint-of-a-polyline"&gt;http://forums.arcgis.com/threads/29061-How-to-find-the-midpoint-of-a-polyline&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can get the center of the polyline and add MapPoint in that location.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 May 2011 17:15:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181438#M4517</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-05-23T17:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181439#M4518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This might be related thread: &lt;A href="http://forums.arcgis.com/threads/29061-How-to-find-the-midpoint-of-a-polyline"&gt;http://forums.arcgis.com/threads/29061-How-to-find-the-midpoint-of-a-polyline&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;You can get the center of the polyline and add MapPoint in that location.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried that but it works only if the polyline is a straight line but what if its not.. see the image is there any other way&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 May 2011 18:12:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181439#M4518</guid>
      <dc:creator>IgressT</dc:creator>
      <dc:date>2011-05-23T18:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181440#M4519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This might be related thread: &lt;A href="http://forums.arcgis.com/threads/29061-How-to-find-the-midpoint-of-a-polyline"&gt;http://forums.arcgis.com/threads/29061-How-to-find-the-midpoint-of-a-polyline&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;You can get the center of the polyline and add MapPoint in that location.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes polyline.extent.getCenter(); gets the polyline center but not exact center like the geometry service for polygon, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polyline.Extent.getCenter() not work for curved line or polygon it draws graphic outside the polygon or polyline i need the exact center of polyline. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for your reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any other option please...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 May 2011 18:23:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181440#M4519</guid>
      <dc:creator>ImtiyazPasha1</dc:creator>
      <dc:date>2011-05-23T18:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181441#M4520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;any help please......&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2011 05:27:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181441#M4520</guid>
      <dc:creator>ImtiyazPasha1</dc:creator>
      <dc:date>2011-05-24T05:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181442#M4521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;finally I got it using ESRI.ArcGIS.Client.Geometry.PointCollection ps in line.Paths&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;esriSymbol:PictureMarkerSymbol&amp;nbsp; x:Key="DefaultRasterSymbol" OffsetX="12" OffsetY="34" Source="" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for all&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 May 2011 07:25:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181442#M4521</guid>
      <dc:creator>ImtiyazPasha1</dc:creator>
      <dc:date>2011-05-24T07:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181443#M4522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You might calculate the center of the polyline at the client side.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Very simplified version:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;public static class GeometryExtension
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static MapPoint Center(this Polyline polyline)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var path = polyline.Paths[polyline.Paths.Count / 2];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int pointIndex = (path.Count-1)/2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MapPoint startPoint = path[pointIndex];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MapPoint endPoint = path[pointIndex + 1];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new MapPoint((startPoint.X + endPoint.X)/2.0, (startPoint.Y + endPoint.Y)/2.0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:black;"&gt;Then you can get the center of a polyline by : MapPoint center= myPolyline.Center();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is just returning the center of the middle segment but you might enhance the code depending on what you need exactly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:16:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181443#M4522</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-11T09:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding point graphic at center of line feature using geometry service</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181444#M4523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Dominique BROUX,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes your right but I did it with different approach.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2011 17:19:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/adding-point-graphic-at-center-of-line-feature/m-p/181444#M4523</guid>
      <dc:creator>ImtiyazPasha1</dc:creator>
      <dc:date>2011-05-25T17:19:14Z</dc:date>
    </item>
  </channel>
</rss>

