1

I am looking to identify and locate maximum values in each individual row of a raster. I have tried many different methods including edge detection (Sobel, Canny, Prewitt, etc.), focal statistics and generating contours (ArcGIS). However, the magnitude of the maximum value vary considerably from row to row - so the lower value maximums are difficult to (visually) identify using the methods mentioned above (see sample image below).

Sample Image

Ideally I would like to start at the top row of the raster and identify the location of the maximum value in each row from top to bottom.

enter image description here

  • Welcome to GIS SE. As a new user, please take the Tour, which explains how our "Focused question/Best answer" model operates. This question is likely too broad to get answers, it's also somewhat opinion-based due to the secondary question. You might be best off trying to implement in what you believe to be the best solution, then returning here with a specific issue in your implementation (if you encounter one). – Vince Jan 24 '19 at 12:05
  • 1
    Secondary question deleted. Also deleted second GIS software tag. Thank you. – user135766 Jan 24 '19 at 12:50
  • 2
    Is it a float or integer raster? What is your desired output? – BERA Jan 24 '19 at 12:58
  • If I understand your problem correctly then I would suggest some form of image enhancement before you run an edge detection for example. Having said that if you use something like a high pass filter in ArcMap then you can play around with the weighting to make these stand out better. – AWGIS Jan 24 '19 at 13:46
  • Is it a float or integer raster? Float – user135766 Jan 24 '19 at 14:37
0

Solution below is using little known raster algebra function ROWMAP.

arcpy.gp.SingleOutputMapAlgebra_sa("$$ROWMAP", "c:/SCRATCH/rows", "")
arcpy.gp.ZonalStatistics_sa("rows", "VALUE", "depth", "C:/SCRATCH/MAX_DEPTH", "MAXIMUM", "DATA")
arcpy.gp.RasterCalculator_sa('Con("MAX_DEPTH" == "depth","depth")', "C:/SCRATCH/EXTRACT")
arcpy.RasterToPoint_conversion(in_raster="EXTRACT", out_point_features="C:/SCRATCH/POINTS.shp", raster_field="Value")
arcpy.PointsToLine_management(Input_Features="POINTS", Output_Feature_Class="C:/SCRATCH/TALVEG.shp", Line_Field="", Sort_Field="", Close_Line="NO_CLOSE")

To make it work make sure that you mxd environment extent, snap raster and cell size are pointing to raster of interest.

Be prepared for surprises, i.e. final line might need manual polish:

enter image description here

| improve this answer | |
  • Rowmap? Now you are just showing off! 😀 – Hornbydd Jan 25 '19 at 0:59
  • Thanks for this FelixIP - this looks like a very interesting solution - I will try it out and let you know how it works for me. DM – user135766 Jan 28 '19 at 12:22
  • FelixP: This solution worked absolutely perfectly - it is a very concise and elegant solution! Thank you very much - I really appreciate it! – user135766 Feb 11 '19 at 11:39
2

If your intention is to create a polyline from the coordinates of the cell with the maximum value on each row why not:

  1. Convert the raster to a point dataset.
  2. Add XY values to the points.
  3. Run summary tool getting max value by Y coordinate (as Y is constant over the row)
  4. Join the Summary table back to your point dataset base upon Y field
  5. Select where value = max value
  6. Export your selection (optional)
  7. Run points to line tool based upon Y field
| improve this answer | |
  • Good one, but raster size could be an issue. – FelixIP Jan 24 '19 at 21:58
  • Many thanks for this - I look forward to trying it out. – user135766 Jan 28 '19 at 12:20

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.