<?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: Add the textSymbol to the center of polyLine in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195123#M18026</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Calculate the angle of the line and set the rotation of the text symbol accordingly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Dec 2014 16:15:11 GMT</pubDate>
    <dc:creator>HeikoHeijenga</dc:creator>
    <dc:date>2014-12-22T16:15:11Z</dc:date>
    <item>
      <title>Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195120#M18023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would like to print a textSymbol on center of the ployLine using the Longitude and Latitude.&lt;/P&gt;&lt;P&gt;I Have written the below code, but Unable to print the textSymbol. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;var labelGraphic = null;&lt;/P&gt;&lt;P&gt;var startX = lLong[0];// These are string values&lt;/P&gt;&lt;P&gt;var endX = lLong[lLong.length-1];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var startY= lLat[0];&lt;/P&gt;&lt;P&gt;var endY = lLat[lLat.length-1];&lt;/P&gt;&lt;P&gt;var midPointX = ((endX - startX) / 2);&lt;/P&gt;&lt;P&gt;var midPointY = ((endY - startY) / 2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var font = new Font("12px", Font.STYLE_NORMAL, Font.STYLE_NULL, Font.VARIANT_NORMAL, Font.WEIGHT_NULL, "Arial");&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;var pipePoint = new Point(((parseFloat(lLong[0]))+midPointX ) , ((parseFloat(lLat[0]))+ midPointY), map.spatialReference);&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;// create a text symbol&amp;nbsp; &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;var textSymbol = new TextSymbol("LABEL TEXT!!!", font, new Color([0, 0, 0]));&amp;nbsp; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt; labelGraphic = new Graphic(pipePoint, textSymbol);&lt;/P&gt;&lt;P&gt;if (labelGraphic != null)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.add(labelGraphic);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me how to add the textSymbol to the polyline.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Dec 2014 09:43:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195120#M18023</guid>
      <dc:creator>SunilKalagata</dc:creator>
      <dc:date>2014-12-19T09:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195121#M18024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to use the midpoint formula:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="42150" alt="midpoint.png" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/42150_midpoint.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(this of course only works if you're dealing with straight lines)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Dec 2014 16:25:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195121#M18024</guid>
      <dc:creator>HeikoHeijenga</dc:creator>
      <dc:date>2014-12-19T16:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195122#M18025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Thankyou for help. But here my polyLine is dynamically changes the direction. I want to display the text along with the line. How do I do that?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Even I tried with &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;textSymbol.setVerticalAlignment()/ setHorizontalMethods also.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 13:26:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195122#M18025</guid>
      <dc:creator>SunilKalagata</dc:creator>
      <dc:date>2014-12-22T13:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195123#M18026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Calculate the angle of the line and set the rotation of the text symbol accordingly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2014 16:15:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195123#M18026</guid>
      <dc:creator>HeikoHeijenga</dc:creator>
      <dc:date>2014-12-22T16:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195124#M18027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any example to calculate the PolyLine angle?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Dec 2014 10:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195124#M18027</guid>
      <dc:creator>SunilKalagata</dc:creator>
      <dc:date>2014-12-23T10:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195125#M18028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are your lines straight lines or real polylines?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Dec 2014 15:41:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195125#M18028</guid>
      <dc:creator>HeikoHeijenga</dc:creator>
      <dc:date>2014-12-23T15:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195126#M18029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Real polylines, we are drawing those using latitude and longitude. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Dec 2014 04:45:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195126#M18029</guid>
      <dc:creator>SunilKalagata</dc:creator>
      <dc:date>2014-12-24T04:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195127#M18030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got this from an earlier post and used it to place an "arrow" (actually the letter "V") at the center of a polyline. Using your variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var rise = endX - startX;&lt;/P&gt;&lt;P&gt;var run = endY - startY;&lt;/P&gt;&lt;P&gt;var angle = (180/Math.PI) * Math.atan2(run,rise);&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;textSymbol.angle = angle;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Dec 2014 13:32:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195127#M18030</guid>
      <dc:creator>TyroneLigon</dc:creator>
      <dc:date>2014-12-24T13:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195128#M18031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tyrone, &lt;/P&gt;&lt;P&gt;Thank you for your update. But here I am using Latitude and Longitude to draw my polyLine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us to find the angle for PloyLine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thankyou!! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Dec 2014 08:30:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195128#M18031</guid>
      <dc:creator>SunilKalagata</dc:creator>
      <dc:date>2014-12-26T08:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195129#M18032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can convert lat/long to XY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/esri.geometry.webmercatorutils-amd.html#lnglattoxy" title="https://developers.arcgis.com/javascript/jsapi/esri.geometry.webmercatorutils-amd.html#lnglattoxy"&gt;esri/geometry/webMercatorUtils | API Reference | ArcGIS API for JavaScript&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might consider using a label layer instead?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Dec 2014 13:24:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195129#M18032</guid>
      <dc:creator>JoshHevenor</dc:creator>
      <dc:date>2014-12-29T13:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Add the textSymbol to the center of polyLine</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195130#M18033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A polyline doesn't have an angle, only a straight line does. But a polyline is made up of smaller straight line segments. Find the segment where you want to place the symbol and calculate it's angle.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Dec 2014 00:31:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-the-textsymbol-to-the-center-of-polyline/m-p/195130#M18033</guid>
      <dc:creator>HeikoHeijenga</dc:creator>
      <dc:date>2014-12-30T00:31:42Z</dc:date>
    </item>
  </channel>
</rss>

