<?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: create point from center of line using arcade in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054421#M5859</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/304310"&gt;@Amanda__Huber&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;As far as I know, that is not possible using Arcade. If you would have Enterprise (or ArcGIS Pro) you could use&amp;nbsp; Arcade in attribute rules to automatically maintain another point layer where the center points would be stored. In the map, you would have to add the point layer and define visibility based on the scale.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For ArcGIS Online, I would probably use ArcGIS Pro and the Feature to Point tool to create the layer or use the Find Locations | Find Centroids (consumes credits) in ArcGIS Online to create the point layer.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 May 2021 21:01:58 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-05-04T21:01:58Z</dc:date>
    <item>
      <title>create point from center of line using arcade</title>
      <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/265615#M1713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know if you can create point symbology from the center coordinate of a line feature using arcade?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2017 03:43:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/265615#M1713</guid>
      <dc:creator>NathanMcKinley3</dc:creator>
      <dc:date>2017-09-11T03:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: create point from center of line using arcade</title>
      <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/265616#M1714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm currently working on this for polygon features.&lt;/P&gt;&lt;P&gt;Using:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;POINT (Centroid(Geometry($feature)))&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But getting this error:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;Execution Error:Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Oct 2017 12:33:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/265616#M1714</guid>
      <dc:creator>DanielHuneycutt</dc:creator>
      <dc:date>2017-10-06T12:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: create point from center of line using arcade</title>
      <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/265617#M1715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think you can use Arcade to visualize polylines as points. The error message seems to refer to the spatial reference. I did a simple test on a hosted feature that I published using the same spatial reference as the base map and it returned the point:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;var geom = Geometry($feature);
Console('\ngeom:' + geom);

var line = Polyline(geom);
Console('\nline:' + line);

var cent = Centroid(line);
Console('\ncent:' + cent);

var pnt = Point(cent);
Console('\npnt:' + pnt);‍‍‍‍‍‍‍‍‍‍‍

return pnt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which yields:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;geom:{"paths":[[[-8414259.482734734,697445.4680427602],[-8414258.288406167,697445.4680427602],[-8414258.288406167,697457.4113284288]]],"spatialReference":{"wkid":102100,"latestWkid":3857}}

line:{"paths":[[[-8414259.482734734,697445.4680427602],[-8414258.288406167,697445.4680427602],[-8414258.288406167,697457.4113284288]]],"spatialReference":{"wkid":102100,"latestWkid":3857}}

cent:{"x":-8414259.482734734,"y":697445.4680427602,"spatialReference":{"wkid":102100,"latestWkid":3857}}

pnt:{"x":-8414259.482734734,"y":697445.4680427602,"spatialReference":{"wkid":102100,"latestWkid":3857}}
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it returns the point, but the symbology will no be what you want (they will remain lines, and you will have an object for your symbology that you cannot actually use):&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/376104_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:59:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/265617#M1715</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T12:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: create point from center of line using arcade</title>
      <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054344#M5855</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;In theory, if you use feature sets with this workflow could you use arcade on a separate point layer to represent the centroid of this line layer?&lt;/P&gt;&lt;P&gt;We're looking to do the same thing, but curious on your thoughts as we get started.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 18:15:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054344#M5855</guid>
      <dc:creator>Amanda__Huber</dc:creator>
      <dc:date>2021-05-04T18:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: create point from center of line using arcade</title>
      <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054354#M5856</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/304310"&gt;@Amanda__Huber&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;So in the symbology profile, Arcade could return a geometry, but this is not something that is valid and that can be used to draw those features. Can you elaborate a bit more on what you have and what you want to get (and explain the why in this a bit more)?&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 18:35:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054354#M5856</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-04T18:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: create point from center of line using arcade</title>
      <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054366#M5857</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Of course, thanks for the quick reply!&lt;BR /&gt;We're looking to visualize construction features (lines and polygons hosted the same service) as points on the map at high scales.&lt;BR /&gt;I know arcade built into the symbology setting doesn't support feature sets, but I was thinking since I have a point layer in the map, if there's a way to use the Point ( json ) (returns { Point }) function by getting the X,Y of the line/poly centroid through feature sets then it could be visualized through that layer. Thoughts?&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 18:54:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054366#M5857</guid>
      <dc:creator>Amanda__Huber</dc:creator>
      <dc:date>2021-05-04T18:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: create point from center of line using arcade</title>
      <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054421#M5859</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/304310"&gt;@Amanda__Huber&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;As far as I know, that is not possible using Arcade. If you would have Enterprise (or ArcGIS Pro) you could use&amp;nbsp; Arcade in attribute rules to automatically maintain another point layer where the center points would be stored. In the map, you would have to add the point layer and define visibility based on the scale.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For ArcGIS Online, I would probably use ArcGIS Pro and the Feature to Point tool to create the layer or use the Find Locations | Find Centroids (consumes credits) in ArcGIS Online to create the point layer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 21:01:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1054421#M5859</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-04T21:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: create point from center of line using arcade</title>
      <link>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1148826#M6194</link>
      <description>&lt;P&gt;I'm not sure if this will be helpful or not, but I'll post it anyway:&lt;/P&gt;&lt;P&gt;In similar situations where we don't have a Midpoint() function, such as in the St_Geometry spatial type in EGDBs, we've used the following hack:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Buffer the line and get the centroid of the resulting polygon.&lt;/STRONG&gt; It's kind of like a "poor man's midpoint".&lt;/P&gt;&lt;P&gt;If I recall, that works ok. But I think I remember the point &lt;U&gt;&lt;EM&gt;not&lt;/EM&gt;&lt;/U&gt; being the &lt;U&gt;&lt;EM&gt;exact&lt;/EM&gt;&lt;/U&gt; midpoint of the line. I forget what the specific issue was. It's probably good enough for most use cases though...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 21:57:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/create-point-from-center-of-line-using-arcade/m-p/1148826#M6194</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-02-28T21:57:07Z</dc:date>
    </item>
  </channel>
</rss>

