I'm working on a project to help our Stormwater division collect data for culverts and rain swails using a high-accuracy GPS. The data will be 3D polylines. They need to indicate the direction of flow, from the high end to the low end of the pipe. I'm still trying to figure out how I can visually represent that, but for now I'm starting with the attribute data.
I need to calculate the difference in elevation from the start point to the end point of the line. I found a tool called Calculate Geometry Attributes that can calculate these values, which works great, but I'd like to automate the process using an Attribute Rule in the database.
Does anyone know how to calculate the Z value of a point using ArcGIS Arcade?
Solved! Go to Solution.
hi,
You might want to check your data then. I just created a demo dataset in a fgdb and it worked for me. Bearing in mind this is a very simple dataset with single part polylines.
start point:
var line = Geometry($feature);
var path = line.paths[0];
var pt = path[0];
return pt.z
end point:
var line = Geometry($feature);
var path = line.paths[0];
var pt = path[-1];
return pt.z
I created three lines and calculated their geometries in fields using the gp tool, then the same using arcade. I then added globalids and attribute rules for two new fields. Finally I digitised two new lines connecting the start and ends of the previously created ones. You can see the attributes were updated successfully and they match the pre-existing lines. I wanted to insert an image but apparently I don't have permission now.
Shape * | Shape_Length | name | start_elev | end_elev | arc_st_elev | arc_end_elev | rule_st_elev | rule_end_elev |
Polyline Z | 477.593909 | a | 128.1235 | 61.531 | 128.1235 | 61.531 | <Null> | <Null> |
Polyline Z | 477.22298 | b | 117.708 | 76.076 | 117.708 | 76.076 | <Null> | <Null> |
Polyline Z | 388.065934 | c | 127.2341 | 66.5974 | 127.2341 | 66.5974 | <Null> | <Null> |
Polyline Z | 435.647143 | a-c | <Null> | <Null> | <Null> | <Null> | 128.1235 | 66.5974 |
Polyline Z | 416.362791 | c-b | <Null> | <Null> | <Null> | <Null> | 127.2341 | 76.076 |
Hi,
You could try starting with the logic here: https://community.esri.com/t5/arcgis-online-questions/calculate-coordinates-of-polyline-in-arcgis-on... but accessing first_point.z and last_point.z
Hope this helps.
Cheers,
Marc
Thanks, I tried that but got a null value returned.
hi,
You might want to check your data then. I just created a demo dataset in a fgdb and it worked for me. Bearing in mind this is a very simple dataset with single part polylines.
start point:
var line = Geometry($feature);
var path = line.paths[0];
var pt = path[0];
return pt.z
end point:
var line = Geometry($feature);
var path = line.paths[0];
var pt = path[-1];
return pt.z
I created three lines and calculated their geometries in fields using the gp tool, then the same using arcade. I then added globalids and attribute rules for two new fields. Finally I digitised two new lines connecting the start and ends of the previously created ones. You can see the attributes were updated successfully and they match the pre-existing lines. I wanted to insert an image but apparently I don't have permission now.
Shape * | Shape_Length | name | start_elev | end_elev | arc_st_elev | arc_end_elev | rule_st_elev | rule_end_elev |
Polyline Z | 477.593909 | a | 128.1235 | 61.531 | 128.1235 | 61.531 | <Null> | <Null> |
Polyline Z | 477.22298 | b | 117.708 | 76.076 | 117.708 | 76.076 | <Null> | <Null> |
Polyline Z | 388.065934 | c | 127.2341 | 66.5974 | 127.2341 | 66.5974 | <Null> | <Null> |
Polyline Z | 435.647143 | a-c | <Null> | <Null> | <Null> | <Null> | 128.1235 | 66.5974 |
Polyline Z | 416.362791 | c-b | <Null> | <Null> | <Null> | <Null> | 127.2341 | 76.076 |
Thanks, I was testing in an AGOL web map. When I tested in Pro it worked just fine.