Select to view content in your preferred language

Add Option {depression} to Contour tool

850
2
07-24-2023 04:51 PM
Status: Open
Labels (1)
WentaoChe
Frequent Contributor

Dear arcpy.ddd.Contour Tool Development Team,

I am writing to propose the inclusion of a additional options to the Contour tool. The suggested enhancements pertain to the ability to add  {depression} Flag directly within the tool's parameters.

The enhanced tool syntax would appear as follows:

arcpy.ddd.Contour(in_raster, out_polyline_features, contour_interval, {base_contour}, {z_factor}, {contour_type}, {max_vertices_per_feature}, {depression})

Since all the depression contours are output as counter-clockwise and non-depression contours as clockwise, this feature is very valuable and should be mentioned in the tool's documentation.

Currently, I have to write separate Python code to flag the closed depression contours. This step is crucial for our flood analysis in urban and sub-urban areas, specifically for flagging closed depression contours.

We would greatly appreciate it if these enhancements could be considered for inclusion in your next release.

Thank you in advance for your attention to this matter.

Best regards,

Wentao Che
Tokyo, Japan

2 Comments
SteveLynch

have you considered Identify Contours?

WentaoChe

Hi @SteveLynch,

Thank you very much for your recommendation.

I would have considered utilizing the arcpy.topographic.IdentifyContours tool, if we had the required license to use it. It's a pity that we do not have that extension license.

I'm lucky to have the opportunity to open and examine its contents since it's a Python script tool. Nevertheless, it appears quite complex for me to grasp entirely. I'm hoping to find a simpler approach to understand it. Here is a snippet of my code.

  depression_count = 0
  query = ' "Flag_tmp" in (2,4) '
  rows = da.UpdateCursor(contour_all,['Shape@','direction2'],query)
  for row in rows:
    partnum = 0
    x_list = []
    y_list = []
    for part in row[0]:
      for pnt in part:
        if pnt:
          x_list.append(pnt.X)
          y_list.append(pnt.Y)
      partnum += 1
    n = len(x_list) - 1
    signedArea = 0.0
    for i in range(n):
      x1 = x_list[i]
      x2 = x_list[i+1]
      y1 = y_list[i]
      y2 = y_list[i+1]
      signedArea += (x2 - x1) * (y2 + y1)
    # Sum over the edges, (x2 − x1)(y2 + y1).
    # If the result is positive the curve is clockwise,
    # if it's negative the curve is counter-clockwise.
    # (The result is twice the enclosed area, with a +/- convention.)
    if signedArea > 0:
      row[1] = 2  # clockwise
    else:
      depression_count += 1
      row[1] = 1  # counter-clockwise
    rows.updateRow(row)
  del rows

 

The reason I suggest this idea is that if the ESRI development team could add a {depression} option to the arcpy.ddd.Contour tool, things would become much simpler and faster. It would save a lot of time for every user of this tool.

Thank you so much for your excellent suggestions!

Best regards,

Wentao Che