<?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: Calculating label points for polyline features in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/calculating-label-points-for-polyline-features/m-p/438564#M2087</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can answer my own question.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I used the Buffer operation to do the conversion for me. It seems to work quite well. Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;public void SomeMethod()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService = new GeometryService("some URL here...");
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.LabelPointsCompleted += OnLabelPointsCompleted;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.SimplifyCompleted += OnSimplifyCompleted;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.BufferCompleted += OnBufferCompleted;

&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.SimplifyAsync(_polylines); // Start by simplifying the polyline graphics to find the label points for
}

private void OnSimplifyCompleted(object sender, GraphicsEventArgs e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; var bufferParams = new BufferParameters();
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.BufferSpatialReference = _spatialReference; // whatever spatial reference you need
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.OutSpatialReference = _spatialReference;
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.Unit = LinearUnit.Centimeter;
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.Distances.Add(1.0d);
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.Features.AddRange(e.Results);

&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.BufferAsync(bufferParams);
}

private void OnBufferCompleted(object sender, GraphicsEventArgs e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.LabelPointsAsync(e.Results);
}

private void OnLabelPointsCompleted(object sender, GraphicsEventArgs e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do someting with label points...
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 19:37:18 GMT</pubDate>
    <dc:creator>AndyFrench</dc:creator>
    <dc:date>2021-12-11T19:37:18Z</dc:date>
    <item>
      <title>Calculating label points for polyline features</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/calculating-label-points-for-polyline-features/m-p/438563#M2086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am writing an application using the Silverlight toolkit to display pipe networks. I need to be able to annotate some of the pipes with additional data and to do this I would like to add a TextSymbol to the middle point of the pipe.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Calculating the center point of the bounding envelope is unsatisfactory when the pipe is curved or looped; the label ends up far away from the pipe.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried to use the Geometry Service REST API and call the Label Points operation. However, it appears the Label Points operation doesn???t support Polylines (the pipes) but only Polygons. Attempting to pass the Polylines to the Geometry Service results in an ???Object reference not set to an instance of an object??? error being returned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any suggestions about how I can get the Label Point for a Polyline?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Nov 2011 09:42:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/calculating-label-points-for-polyline-features/m-p/438563#M2086</guid>
      <dc:creator>AndyFrench</dc:creator>
      <dc:date>2011-11-24T09:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating label points for polyline features</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/calculating-label-points-for-polyline-features/m-p/438564#M2087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can answer my own question.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I used the Buffer operation to do the conversion for me. It seems to work quite well. Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;public void SomeMethod()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService = new GeometryService("some URL here...");
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.LabelPointsCompleted += OnLabelPointsCompleted;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.SimplifyCompleted += OnSimplifyCompleted;
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.BufferCompleted += OnBufferCompleted;

&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.SimplifyAsync(_polylines); // Start by simplifying the polyline graphics to find the label points for
}

private void OnSimplifyCompleted(object sender, GraphicsEventArgs e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; var bufferParams = new BufferParameters();
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.BufferSpatialReference = _spatialReference; // whatever spatial reference you need
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.OutSpatialReference = _spatialReference;
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.Unit = LinearUnit.Centimeter;
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.Distances.Add(1.0d);
&amp;nbsp;&amp;nbsp;&amp;nbsp; bufferParams.Features.AddRange(e.Results);

&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.BufferAsync(bufferParams);
}

private void OnBufferCompleted(object sender, GraphicsEventArgs e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; _geometryService.LabelPointsAsync(e.Results);
}

private void OnLabelPointsCompleted(object sender, GraphicsEventArgs e)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do someting with label points...
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:37:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/calculating-label-points-for-polyline-features/m-p/438564#M2087</guid>
      <dc:creator>AndyFrench</dc:creator>
      <dc:date>2021-12-11T19:37:18Z</dc:date>
    </item>
  </channel>
</rss>

