I want to extract the shore line (Z=0) from DEM files. the earth explorer provides two DEM sources (ASTER & SRTM).

In the following figure if the blue line represents the shore line as digitized from the topographic map, and both the other red and green lines are the shore lines as extracted from the two DEM sources.

Is there a tool in ArcGIS allows me to determine which of the red and green polylines is closer to the blue one.

enter image description here

  • 2
    It depends what you want to do with it.. if it's only for mapping then likely either will do but if you want to calculate land area or distance to/from the coast will a few hundred metres really matter? If yes then it would probably be better to heads-up digitize from orthophoto.. note that coastlines are constantly changing and quite hard to define exactly even in stereophoto. Commented Feb 28, 2017 at 5:40

2 Answers 2


In addition to the raster solution I provided, here's a vector solution.

The first thing I did was to convert the vertices of the DEM1 and DEM2 lines to points. To convert to points, you can use Feature Vertices to Points, or if you don't have an Advanced licence, you can use the Feature Class to Points tool, or create your own arcpy solution.

In the below image, DEM1 is red and DEM2 is green. The topo line is blue.

enter image description here

Next, in your points layer, create a field to store distance. This will hold the distance from the point to the Topo line. You can use the Near tool, or if you don't have the Advanced license, you can use arcpy.

I used arcpy, which looked something like this:

First get the geometry of the topo line ( sr is your spatial reference - whatever coordinate system you're using).

with arcpy.da.SearchCursor("Topo_Line", "SHAPE@", spatial_reference = sr) as sTopoCur:
    for row in sTopoCur:
        topoGeom = row[0]

Then calculate the distance from each point to the topoline.

with arcpy.da.UpdateCursor("DEM1_Points",["SHAPE@X","SHAPE@Y","Distance"], sr) as uCur:
    for row in uCur:
        thePoint = arcpy.Point(row[0],row[1])
        thePointGeom = arcpy.PointGeometry(thePoint,sr)
        row[2] = thePointGeom.distanceTo(topoGeom)

Repeat again for DEM2_Points.

The results can be seen in the attribute table:

enter image description here

Right clicking on the Distance field name in the attribute table, click on Statistics...

enter image description here

You can see how the point distances differ by comparing the statistics for each of them:

DEM1 Points: enter image description here

DEM2 Points: enter image description here

You can see that DEM1 Points have a smaller mean, which is expected since it follows the topo line more closely.

| TableName   | Minimum  | Maximum    | Mean       | Standard Deviation |
| DEM1_Points | 0.000001 | 110.073997 | 25.955782  | 38.645082          |
| DEM2_Points | 0.000094 | 310.643433 | 129.651896 | 72.359374          |

The results are different than the raster solution because we're looking at distance of vertices to the topo line, rather than the entire line to the topo line. However, overall, both methods result in showing that DEM1 line is a better fit.

  • 1
    Outstanding answer, well described. One possible branch from this root method is rather than selecting the line which best matches the reference topo line one could select the vertices closest to reference, and then generate a new line from those vertices. (Depending on project needs this may or may not be a good idea.) Commented Apr 16, 2018 at 23:03
  • Yes, that's a great point. In this case, that probably would be the way to go.
    – Fezter
    Commented Apr 16, 2018 at 23:40

I tried replicating this using Spatial Analyst. Firstly, I created three lines in different feature classes (though they could be in the same feature class).

  1. Topo Line (blue)
  2. DEM 1 (red)
  3. DEM 2 (green)

enter image description here

You can see that in my case, the red follows the blue more closely.

Then, I created a Euclidean Distance Raster from the blue topo line. My extents were slightly larger than the input.

enter image description here

Finally, I ran Zonal Statistics as table on both the red and green lines.

The results look like this:


enter image description here


enter image description here

You can see that the mean is larger for the green line (DEM 2).

There might be better ways to assess this. You might need a different method if your lines are actually polygons and not lines.

EDIT: I have also added a vector solution as a separate answer.

  • Vector solution to my test, combination of features to polygons and compare areas. Perhaps adding 2 lines at the end. Same conclusion though:) +1
    – FelixIP
    Commented Feb 28, 2017 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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