<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: average of ice edge lines (distance from coast) in Spatial Data Science Questions</title>
    <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678276#M1554</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That was it!&amp;nbsp; I had clipped my ice edges to an outline of my study site and discovered some topology issues between the coastline and the ice-free areas of the coast.&amp;nbsp; When I preformed the clip, some of the ice edges became fragmented and that threw off the results.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Now I have some nice summary statistics to work with.&amp;nbsp; Thanks for your help (and extra brownie points for working weekends!)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 01 May 2016 23:11:31 GMT</pubDate>
    <dc:creator>AarielRocha1</dc:creator>
    <dc:date>2016-05-01T23:11:31Z</dc:date>
    <item>
      <title>average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678260#M1538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have developed landfast sea ice extents that can be visualized as polygons, lines or rasters.&amp;nbsp; Now I need to calculate &lt;SPAN style="line-height: 1.5;"&gt;monthly and yearly averages and it is much more difficult to create an average line from a set of polylines than I had imagined.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;I first tried to use raster world and the Euclidean Distance tools to determine the distance from shore, but since the ice lines and the shoreline are so complex I needed a way to measure the distance from the same point on land or the averages are meaningless.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;so, I developed a set of tangent lines and intersected them with my ice edge lines to get a set of points.&amp;nbsp; I have been able to use spatial join to get the distances from shore and then add field and field calculator to get average distances along each of my tangent lines.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;My plan is to then plot the average distances for each tangent line as a point and then connect the points to show the 'average' of my original ice edge lines for each month and year.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;I think that I need to use linear referencing tools to get past this latest hurdle, so I created routes from my set of tangent lines.&amp;nbsp; Now I need to create points that are my 'average distance' from shore but I am at a loss.&amp;nbsp; I have minimal experience scripting and would appreciate help using the geoprocessing tools in modelbuilder.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;Aariel&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jan 2016 21:54:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678260#M1538</guid>
      <dc:creator>AarielRocha1</dc:creator>
      <dc:date>2016-01-25T21:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678261#M1539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now you did say you had lines radiating out to those lines... just a thought &lt;A href="http://desktop.arcgis.com/en/desktop/latest/manage-data/editing-existing-features/splitting-lines-at-a-specified-distance-or-percentage.htm" title="http://desktop.arcgis.com/en/desktop/latest/manage-data/editing-existing-features/splitting-lines-at-a-specified-distance-or-percentage.htm"&gt;Splitting lines at a specified distance or percentage—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jan 2016 21:59:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678261#M1539</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-25T21:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678262#M1540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response Dan.&lt;/P&gt;&lt;P&gt;I have already split my tangent lines at the intersections with each of my ice edge lines.&amp;nbsp; That is how I got the lengths (=distance from shore) for each date that I needed to get the average distances.&lt;/P&gt;&lt;P&gt;Now I need to get the endpoints from lines that are the average distance from shore.&lt;IMG alt="tangentlinestoaverage2.jpg" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/173749_tangentlinestoaverage2.jpg" style="width: 620px; height: 803px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jan 2016 18:14:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678262#M1540</guid>
      <dc:creator>AarielRocha1</dc:creator>
      <dc:date>2016-01-26T18:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678263#M1541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;looks like this approach may help.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/message/476820"&gt;Creating points at a specific distance from other points along a line&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jan 2016 19:27:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678263#M1541</guid>
      <dc:creator>AarielRocha1</dc:creator>
      <dc:date>2016-01-26T19:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678264#M1542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe you can follow these steps (sorry, can't test right now):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.) &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Create_Routes/003m00000005000000/"&gt;Create Routes&lt;/A&gt; from your tangent lines&lt;/P&gt;&lt;P&gt;2.) &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Intersect/00080000000p000000/"&gt;Intersect &lt;/A&gt;the ice extent lines with the tangent lines to get intersection points (specify point as output type)&lt;/P&gt;&lt;P&gt;3.) &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Locate_Features_Along_Routes/003m00000007000000/"&gt;Locate Features Along Routes&lt;/A&gt; (features = your intersection points) to get measures for each point&lt;/P&gt;&lt;P&gt;4.) &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Summary_Statistics/00080000001z000000/"&gt;Summary Statistics&lt;/A&gt; to get stats for each tangent line&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jan 2016 19:39:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678264#M1542</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2016-01-26T19:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678265#M1543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, I gave it a shot and this is what I got so far...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I took a random part of the globe:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/174228_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;... OK, I admit I georeferenced the image that was attached. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/silly.png" /&gt;&lt;/P&gt;&lt;P&gt;Digitized the coast line, and 4 ice edges (no to mucho detail) and started coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The process consists of the following steps:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;get the coast line polyline &lt;/LI&gt;&lt;LI&gt;create a featureclass to store the routes (ice edges where each vertice has a m-value representing the relative position on the coast line)&lt;/LI&gt;&lt;LI&gt;loop through the ice edges and fill the m-enabled featureclass with the ice edge routes&lt;/LI&gt;&lt;LI&gt;create a table with events and fill with YEAR values and M values&lt;/LI&gt;&lt;LI&gt;execute MakeRouteEventLayer_lr to generate a layer with point events based on the ice edge routes and the event table&lt;/LI&gt;&lt;LI&gt;create a nested dictionary with the event points and relevant information&lt;/LI&gt;&lt;LI&gt;get min, max and mean statistics from the nested dictionary&lt;/LI&gt;&lt;LI&gt;... generate polylines and write the resulting geometries and statistics to the output featureclass&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example area showing the ice edges with the event points created on the lines with the m value (the relative position on the coast line). &lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/174229_pastedImage_2.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and the resulting MIN, MAX and MEAN lines (comparing the event points on the ice edge lines based on the m-values and distance to the coast line) :&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/174254_pastedImage_3.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code used:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; import os

&amp;nbsp;&amp;nbsp;&amp;nbsp; # input and output featureclasses
&amp;nbsp;&amp;nbsp;&amp;nbsp; # fc_coast = r'D:\Xander\GeoNet\IceEdges\data.gdb\coast'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_coast = r'D:\Xander\GeoNet\IceEdges\data.gdb\coast_simple'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_ice = r'D:\Xander\GeoNet\IceEdges\data.gdb\ice_edges'

&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_id = 'YEAR' # should be unique long
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_stats = 'Stats'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_dist = 'Distance'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_m_value = 'M_Value'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fld_loc_err = 'LOC_ERROR'

&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_routes = r'D:\Xander\GeoNet\IceEdges\data.gdb\routes_v04'
&amp;nbsp;&amp;nbsp;&amp;nbsp; tbl_events = r'D:\Xander\GeoNet\IceEdges\data.gdb\tbl_events_v04'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_events = r'D:\Xander\GeoNet\IceEdges\data.gdb\events_v04'
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_res = r'D:\Xander\GeoNet\IceEdges\data.gdb\result_v04'

&amp;nbsp;&amp;nbsp;&amp;nbsp; # settings
&amp;nbsp;&amp;nbsp;&amp;nbsp; ws, fc_name = os.path.split(fc_routes)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = ws
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.overwriteOutput = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; steps = 1000

&amp;nbsp;&amp;nbsp;&amp;nbsp; # get the coast line (asume first feature in coast fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; coast_line = arcpy.da.SearchCursor(fc_coast,('SHAPE@')).next()[0]

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create output polyline zm featureclass
&amp;nbsp;&amp;nbsp;&amp;nbsp; sr = arcpy.Describe(fc_coast).spatialReference
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management(ws, fc_name, "POLYLINE", None, "ENABLED", "DISABLED", sr)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # add field
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc_routes, fld_id, "LONG")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # loop through ice edges and create dct with polyline m values
&amp;nbsp;&amp;nbsp;&amp;nbsp; dct_polyline_m = {}
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(fc_ice,('SHAPE@', fld_id)) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline_ice = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst = []
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for part in polyline_ice:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for pnt in part:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pntg_ice = arcpy.PointGeometry(pnt, sr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pntg_on_line, m_value_coast, dist_to_coast, right_side = coast_line.queryPointAndDistance(pntg_ice, True)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt_m = arcpy.Point(pnt.X, pnt.Y, None, m_value_coast * 100.0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst.append(pnt_m)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline_m = arcpy.Polyline(arcpy.Array(lst), sr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dct_polyline_m[year] = polyline_m

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create routes featureclass
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.InsertCursor(fc_routes, ('SHAPE@', fld_id)) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for year, polyline_m in dct_polyline_m.items():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.insertRow((polyline_m, year, ))

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create table with events
&amp;nbsp;&amp;nbsp;&amp;nbsp; ws, tbl_name = os.path.split(tbl_events)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateTable_management(ws, tbl_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(tbl_name, fld_id, "LONG")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(tbl_name, fld_m_value, "DOUBLE")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # get list of ID's (years)
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_ids = sorted(list(set([r[0] for r in arcpy.da.SearchCursor(fc_ice, (fld_id))])))

&amp;nbsp;&amp;nbsp;&amp;nbsp; # fill events table
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.InsertCursor(tbl_events, (fld_id, fld_m_value)) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for step in range(steps + 1):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m = float(step) / float(steps) * 100.0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for y in lst_ids:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.insertRow((y, m, ))

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create de route events
&amp;nbsp;&amp;nbsp;&amp;nbsp; event_props = "{0} POINT {1}".format(fld_id, fld_m_value)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeRouteEventLayer_lr(in_routes=fc_routes, route_id_field=fld_id,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in_table=tbl_events,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in_event_properties=event_props,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out_layer="EventPoints", offset_field="",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add_error_field="ERROR_FIELD",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add_angle_field="NO_ANGLE_FIELD",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; angle_type="NORMAL",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; complement_angle="ANGLE",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; offset_direction="LEFT",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point_event_type="POINT")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # write the events to a fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("EventPoints", fc_events)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # generate nested dct with event points and distance to coast (only no error events)
&amp;nbsp;&amp;nbsp;&amp;nbsp; where = "{0} = 'NO ERROR'".format(arcpy.AddFieldDelimiters(fc_events, fld_loc_err))
&amp;nbsp;&amp;nbsp;&amp;nbsp; dct_all = {}
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_m = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(fc_events,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ('SHAPE@', fld_id, fld_m_value),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where_clause=where) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pntg = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_m.append(m)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = pntg.distanceTo(coast_line)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if m in dct_all:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dct = dct_all&lt;M&gt;&lt;/M&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dct&lt;Y&gt; = [pntg, d]&lt;/Y&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dct_all&lt;M&gt; = dct&lt;/M&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dct = {y: [pntg, d]}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dct_all&lt;M&gt; = dct&lt;/M&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create list of m values
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_m = sorted(list(set(lst_m)))

&amp;nbsp;&amp;nbsp;&amp;nbsp; # stats
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_min, dist_min = getStatPointsFromDct(dct_all, lst_m, lst_ids, "MIN")
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_max, dist_max = getStatPointsFromDct(dct_all, lst_m, lst_ids, "MAX")
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_mean, dist_mean = getStatPointsFromDct(dct_all, lst_m, lst_ids, "MEAN")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # create output fc for result
&amp;nbsp;&amp;nbsp;&amp;nbsp; ws, fc_name = os.path.split(fc_res)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CreateFeatureclass_management(ws, fc_name, "POLYLINE", None, "ENABLED", "DISABLED", sr)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # add fields to result fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc_res, fld_stats, "TEXT", None, None, 25)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc_res, fld_dist, "DOUBLE")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # write results to output featureclass
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.InsertCursor(fc_res, ('SHAPE@', fld_stats, fld_dist)) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # MIN:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline = arcpy.Polyline(arcpy.Array(lst_min), sr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.insertRow((polyline, "MIN", dist_min, ))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # MAX:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline = arcpy.Polyline(arcpy.Array(lst_max), sr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.insertRow((polyline, "MAX", dist_max, ))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # MEAN:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polyline = arcpy.Polyline(arcpy.Array(lst_mean), sr)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.insertRow((polyline, "MEAN", dist_mean, ))


def getStatPointsFromDct(dct_all, lst_m, lst_ids, stat):
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_polyline = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_dist = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for m in lst_m:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if m in dct_all:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dct = dct_all&lt;M&gt;&lt;/M&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d_min = None
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = None
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for y, lst in dct.items():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pntg = lst[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = lst[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if d_min is None:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d_min = d
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt_min = pntg.firstPoint
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d_max = d
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt_max = pntg.firstPoint
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d_sum = d
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_x = [pntg.firstPoint.X]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_y = [pntg.firstPoint.Y]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d_sum += d
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_x.append(pntg.firstPoint.X)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_y.append(pntg.firstPoint.Y)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if d &amp;lt; d_min:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d_min = d
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt_min = pntg.firstPoint
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if d &amp;gt; d_max:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d_max = d
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt_max = pntg.firstPoint
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if stat == "MIN":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_polyline.append(pnt_min)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_dist.append(d_min)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif stat == "MAX":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_polyline.append(pnt_max)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_dist.append(d_max)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif stat == "MEAN":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_polyline.append(arcpy.Point(sum(lst_x)/len(lst_x), sum(lst_y)/len(lst_y)))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_dist.append(d_sum/len(lst_x))
&amp;nbsp;&amp;nbsp;&amp;nbsp; return lst_polyline, sum(lst_dist)/len(lst_dist)


if __name__ == '__main__':
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At second intent I simplified the cost line (less detail, since the more detail and strange forms it has, the bigger the effect on erroneous distribution of the events over the edge lines:&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" src="https://community.esri.com/legacyfs/online/174255_pastedImage_51.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;after the simplification of the coast line (with a higher step setting):&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-5 jive-image" src="https://community.esri.com/legacyfs/online/174256_pastedImage_54.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:35:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678265#M1543</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T04:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678266#M1544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;interesting implementation Xander and some great points raised.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 01:46:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678266#M1544</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-28T01:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678267#M1545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan. I left the median out, since that would raise more discussion related to how to define the median point based on 4 lines in my case. I would prefer to take the two median points and determine the middle between them, but not sure if that would be correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 02:28:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678267#M1545</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-01-28T02:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678268#M1546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Short answe&lt;/STRONG&gt;r.... take the "middle" between the middle two lines for an even set of lines... take the middle line if the line set is odd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cavaet... the sea ice people in my department do not necessarily share the views expressed here &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;Perhaps branch this as a discussion&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read below only if you really need to &lt;/P&gt;&lt;P&gt;------------------------------------&lt;/P&gt;&lt;P&gt;medians are tricky, for polygons of predictable geometry it is fairly well agreed upon, but for complex geometries, you are talking about a medial axis (skeleton) but still the controversy would remain&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is the median the middle of the values of X and Y?&lt;/LI&gt;&lt;LI&gt;Do you account for orientation when you are performing the above?&lt;/LI&gt;&lt;LI&gt;If you only have the bounding points and assumed edges, is the median space the area delineated by the normal axis lines extending inwards to the other side?&amp;nbsp; Where those lines meet, they may form more than one point of intersection. Do you then go back to the beginning and proceed downward again?&lt;/LI&gt;&lt;LI&gt;It is "easy" for regular polygons and few well-behaving lines.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In your case, you have 4 lines.&amp;nbsp; the question becomes, where and how do you collapse them into a single medial point.&amp;nbsp; I would argue against the average for the very reason that 3 of the 4 lines may be closely spaced and the 4th a some distance.&amp;nbsp; As for any median, what represent the distribution's middleness based upon sequential position rather than arithmetic average.&amp;nbsp; So following those rules that apply to other properties, you could take the middle point in the ordered list of attributes.&amp;nbsp; Should the distribution be even, it is generally agreed that the average of the middle two is used... if odd, the middle value is used (although, there is some "issues" associated with using that definition).&amp;nbsp; A plausible solution would be to take the middle two lines out of the four and "collapse to center line" aka, create a medial axis/skeleton if you consider the linear distribution as simply representing a long polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short...no one can fault any descriptor of the median, since it is a nebulous quantity for univariate discrete properties, it becomes "middle-ness" for continuous, and when you throw in more than one dimension you often find yourself flipping back and forth between boundaries/lines to points to boundaries/lines to points etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 03:05:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678268#M1546</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-28T03:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678269#M1547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much, I will try this now&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Jan 2016 00:04:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678269#M1547</guid>
      <dc:creator>AarielRocha1</dc:creator>
      <dc:date>2016-01-31T00:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678270#M1548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just got this, but if you have the coast line and have the mean, median, or average distances in fields, you can use this distance field to buffer the coast line to created polygons, then convert the polygons to lines, then simply split the lines at the ends where you need to, you can choose to use square ends versus rounded ends.&amp;nbsp; With this your lines are tied to the coast line.&amp;nbsp; Just a thought.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Jan 2016 03:12:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678270#M1548</guid>
      <dc:creator>ChadKopplin</dc:creator>
      <dc:date>2016-01-31T03:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678271#M1549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander,&lt;/P&gt;&lt;P&gt;I was called away for another project, so I am just now trying to apply your code.&amp;nbsp; Could you explain more how files were set up prior to running the code?&amp;nbsp; I have each of my ice lines in separate feature classes within a geodatabase, but am getting errors that runtime cannot open the ice edge files after line 40 (part of # loop through ice edges and create dct with polyline m values). it seems that I don't have the files in the proper format.&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2016 01:51:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678271#M1549</guid>
      <dc:creator>AarielRocha1</dc:creator>
      <dc:date>2016-04-25T01:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678272#M1550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/155524" target="_blank"&gt;Aariel Rocha&lt;/A&gt; , maybe the easiest way to explain it, is attaching the data so you can have a look yourself. With respect to the data the following is important:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# fc_coast = r'D:\Xander\GeoNet\IceEdges\data.gdb\coast'
fc_coast = r'D:\Xander\GeoNet\IceEdges\data.gdb\coast_simple'
fc_ice = r'D:\Xander\GeoNet\IceEdges\data.gdb\ice_edges'
fld_id = 'YEAR' # should be unique long&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fc "coast" and "coast_simple" are featureclasses that contains a single line describing the coast. The simplified coast line works best.&lt;/P&gt;&lt;P&gt;The ice_edges fc contains all the ice_edges and has a field called "YEAR" that has unique values for each ice edge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also included some of the intermediate results and the final result "result_v04" based on the simple coast line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc_routes = r'D:\Xander\GeoNet\IceEdges\data.gdb\routes_v04'
tbl_events = r'D:\Xander\GeoNet\IceEdges\data.gdb\tbl_events_v04'
fc_events = r'D:\Xander\GeoNet\IceEdges\data.gdb\events_v04'
fc_res = r'D:\Xander\GeoNet\IceEdges\data.gdb\result_v04&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have any questions, please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:35:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678272#M1550</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T04:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678273#M1551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you kindly for your support on this problem.&amp;nbsp; I have been able to apply the script properly, however when I modified the ice lines something strange happened.&amp;nbsp; It seems that when the routes are created there is a sort of 'doubling back' in a straight line that throws of the results.&amp;nbsp; Since the problem began when I modified length of the ice lines by clipping off the ends, I think it may have to do with the step setting?&lt;IMG alt="maxmin2.jpg" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/197784_maxmin2.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2016 23:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678273#M1551</guid>
      <dc:creator>AarielRocha1</dc:creator>
      <dc:date>2016-04-29T23:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678274#M1552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/155524"&gt;Aariel Rocha&lt;/A&gt; , could you attach a sample of the modified ice line?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There could be several reasons for this behavior. Are the features still single part? If not this could be a reason since maybe the parts have different directions (some pointing north some south).&lt;/P&gt;&lt;P&gt;Another reason may be that there may be several features that have the same "YEAR"value. It is supposed that the field contains unique values (one feature per year). If this is not the case, you may need to dissolve the lines by YEAR and use the unsplit option and check if the features are created correctly (single parts). &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 May 2016 00:57:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678274#M1552</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-05-01T00:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678275#M1553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander,&lt;/P&gt;&lt;P&gt;Each of my ice lines is single part, and all year values are unique.&amp;nbsp; However, looking closely at my lines, I see that the offending ones have breaks in them &lt;IMG alt="Untitled.jpg" class="image-1 jive-image" height="261" src="https://community.esri.com/legacyfs/online/197868_Untitled.jpg" style="height: 261.297px; width: 202px;" width="202" /&gt;(and thus may behave as a multipart, I suppose).&amp;nbsp; I will fix those and try again.&lt;/P&gt;&lt;P&gt;Thank you very much for your quick response.&amp;nbsp; Your assistance has been instrumental in my progress and is much appreciated.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Aariel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 May 2016 17:39:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678275#M1553</guid>
      <dc:creator>AarielRocha1</dc:creator>
      <dc:date>2016-05-01T17:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678276#M1554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That was it!&amp;nbsp; I had clipped my ice edges to an outline of my study site and discovered some topology issues between the coastline and the ice-free areas of the coast.&amp;nbsp; When I preformed the clip, some of the ice edges became fragmented and that threw off the results.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Now I have some nice summary statistics to work with.&amp;nbsp; Thanks for your help (and extra brownie points for working weekends!)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 May 2016 23:11:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678276#M1554</guid>
      <dc:creator>AarielRocha1</dc:creator>
      <dc:date>2016-05-01T23:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678277#M1555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/155524"&gt;Aariel Rocha&lt;/A&gt; , I'm glad you found the reason for the problem. Indeed if you select a single feature and you see several "parts" light up, it is a multi part. Having multi parts will have a negative effect on the script. It does not handle them well, I guess.&lt;/P&gt;&lt;P&gt;I am glad to hear that the script is helping you to analyze the ice lines. If you are ready with the analysis and you are willing (and you are allowed) to share some results, it would be very nice to post them back at this thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is anything else, just let us know. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2016 01:18:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678277#M1555</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-05-02T01:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678278#M1556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I though this was an interesting problem, and, waffle-head that I am, went at it with an entirely raster approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;This conveniently avoids issues of topology!&lt;/LI&gt;&lt;LI&gt;There's a lot of variability in these ice extent lines so I took the approach of averaging distances for equal length reaches of coastline, instead of thousands of tangent lines. You could simplify the coastline just for the allocation processing to straighten it enough to allow more bands if you wanted to split the coastline more.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this is a neat example of a problem that can be expressed and solved very simply using map algebra.&amp;nbsp; That said, I am in awe of Xander's code up-thread. Xander probably provided a more accurate solution than this raster approach, pretty as it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from arcpy.sa import *
env.extent = "coast_simple"
env.cellSize = 10000
# create a raster of coastline cells
arcpy.PolylineToRaster_conversion("coast_simple", "OBJECTID", "ccell")
# Create coastline cell zones
# find the southernmost cell (this approach would vary with coastline config)
arcpy.RasterToPoint_conversion("ccell", "ccellpt")
arcpy.AddXY_management("ccellpt")
where = "ABS(POINT_Y - {}) &amp;lt; .001".format(arcpy.Describe("ccellpt").extent.YMin)
arcpy.MakeFeatureLayer_management("ccellpt", "cmin", where)
# Create 20 equal-length reaches along coast line
cc = ExtractByMask(CostDistance("cmin", Con(IsNull("ccell"), 1e6, 1)), "ccell")
cc1 = Slice(cc, 20, "EQUAL_AREA")
# separate ocean into areas corresponding to each coastline reach
calloc = EucAllocation(cc1)
# calculate distance from (any) coastline
cdist = EucDistance(cc1)
# get statistics for ice lines along coast for each year
for year in [2008, 2009, 2010, 2011]:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("ice_edges", "", "YEAR = {}".format(year))
&amp;nbsp;&amp;nbsp;&amp;nbsp; ZonalStatisticsAsTable(ExtractByMask(calloc, "ice_edges"), "VALUE", cdist, "stats_{}".format(year), "DATA")&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="197955" alt="Screen Shot 2016-05-02 at 9.54.46 PM.png" class="image-1 jive-image" src="/legacyfs/online/197955_Screen Shot 2016-05-02 at 9.54.46 PM.png" style="width: 620px; height: 335px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:35:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678278#M1556</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-12T04:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: average of ice edge lines (distance from coast)</title>
      <link>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678279#M1557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very cool!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 11:18:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/spatial-data-science-questions/average-of-ice-edge-lines-distance-from-coast/m-p/678279#M1557</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2016-05-03T11:18:06Z</dc:date>
    </item>
  </channel>
</rss>

