create point from center of line using arcade

09-10-2017 08:43 PM
New Contributor

Does anyone know if you can create point symbology from the center coordinate of a line feature using arcade?

0 Kudos
6 Replies
New Contributor II

I'm currently working on this for polygon features.


POINT (Centroid(Geometry($feature)))

But getting this error:

Execution Error:Cannot create Geometry in this SpatialReference. Engine is using a different spatial reference.
Esri Esteemed Contributor

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:

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;

Which yields:





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):

0 Kudos
Regular Contributor


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?

We're looking to do the same thing, but curious on your thoughts as we get started. 



0 Kudos
Esri Esteemed Contributor

Hi @Amanda__Huber ,

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)?

0 Kudos
Regular Contributor

Hi @XanderBakker ,
Of course, thanks for the quick reply!
We're looking to visualize construction features (lines and polygons hosted the same service) as points on the map at high scales.
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?

Thanks again!

0 Kudos
Esri Esteemed Contributor

Hi @Amanda__Huber ,

As far as I know, that is not possible using Arcade. If you would have Enterprise (or ArcGIS Pro) you could use  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. 

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. 

0 Kudos