How Arcade can access Z coordinates when calculating field values

941
3
12-26-2018 10:55 AM
GaëtanLAVENU
Esri Contributor

Hi,

I try to calculate de mean of Z coordinates of my polylines using Arcade expression. I use the expression below on a feature layer of Polylines (with not null Z coordinates) but the Z values of each vertices returned by the Arcade expression is always "null". The "IsEmpty" console message return "true" for each vertices. Is there a way to get the Z coordinates with the "calculate field" Arcade profile ?

var myPaths = Geometry($feature).paths;
var points_Z = [];

for (var i=0;i<Count(myPaths);i++){
   var myPath = myPaths;
   for (var j=0;j<Count(myPath);j++){
     Console(IsEmpty(myPath.z));
      points_Z[Count(points_Z)] = myPath.z;
      }
   }

return Mean(points_Z);

 

Regards,

Gaëtan Lavenu

Esri France

0 Kudos
3 Replies
XanderBakker
Esri Esteemed Contributor

I think the Z values get stripped off when you publish the layer. I just published a polyline 3D based on the sample here: https://community.esri.com/people/xander_bakker/blog/2016/07/08/working-with-3d-and-m-aware-geometri... and when I publish the layer to ArcGIS Online and consult the layer through the REST API I notice that it does have the property Z enabled, but doing a query returns a geometry without Z values. In addition when you do a "Text($feature)" in the Arcade window you will see that the geometry does not have any Z values:

GaëtanLAVENU
Esri Contributor

Hi Xander,

Thank you for your answer. I have the same issue. When I query the Rest API the feature layer has z enabled but when using Arcade with the "Text($feature)" instruction, Z values are not returned in the paths arrays. I don't know why ?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Kelly Gerrow‌, Can you confirm this behavior? Is there a way to use Arcade in ArcGIS Online and have access to the 3D properties of a geometry?

0 Kudos