i'm using the Modelbuilder in ArcGIS 10.1 to calculate pixels depending on their slope and distance from the road. The third necessary task is to find out, if the pixel is upwards the road or downwards. Is there any fast solution to do this. The question sounds simple but in ArcGIS i have no idea to that.

My first steps are: Do Cost allocation from roadpoints and slope, getting areas which would be accessable from the roadpoint, then interpolating z value to each area, calculating the mean height and compare it to the height of the streetpoint value! This is a really dirty way to do so and i would be thankful for any help

  • Could you explain what "upwards" and "downwards" of the road might mean? After all, when a road winds around in the hills, each point is simultaneously uphill of portions of the road and downhill of other portions.
    – whuber
    Nov 20, 2013 at 17:35

1 Answer 1


I haven't done anything like this before but my guess is you need to make a Near Table. To do this, I'm thinking you'll need to create points from the raster first. Then make your Near Table and include the optional "Add Location Field". Once you have that table you'll need to figure out the elevation of the points from the road feature that are in the Near Table. There must be better ways, but off the top of my head, 1)Create Feature Class from the XY of the Near Table, 2)Extract Values to Points (Spatial Analyst) with the 'Near Table' Feature class you've just created as the input, and whatever DEM you're using as the raster, 3)Add field and Calculate it with the difference between the value of each pixel-point, compared to the value of the road-points.

So to recap,

1)RasterToPoint_conversion (in_raster, out_point_features, {raster_field})

2)GenerateNearTable_analysis (in_feature=points_from_raster, near_features=road_features, out_table, {search_radius}, {location}=True, {angle}, {closest}, {closest_count})

3)MakeXYEventLayer_management (table=near_table, in_x_field, in_y_field, out_layer, {spatial_reference}, {in_z_field})

4)ExtractValuesToPoints (in_point_features=xy_event_layer, in_raster=your_raster, out_point_features, {interpolate_values}, {add_attributes})

5)AddField_management (in_table=extracted_values_to_points_fc, field_name, field_type, {field_precision}, {field_scale}, {field_length}, {field_alias}, {field_is_nullable}, {field_is_required}, {field_domain})

6)CalculateField_management (in_table=xy_event_layer, field=just_created_field, expression="extracted_field_value - road_elev", {expression_type}, {code_block})

haha, I hope it works. You should end up with a positive or negative number for each pixel. You have a fair bit of figuring out and making sure it runs together to do yet, but it's a start.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.