<?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: ArcGIS Pro M value tools: Is &amp;quot;Set Direction As M&amp;quot; in arcpy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcgis-pro-m-value-tools-is-quot-set-direction-as/m-p/1282833#M67518</link>
    <description>&lt;P&gt;Think you'll have to do it manually with a cursor and extracting the m from the point.&amp;nbsp; Stealing a post from &lt;A href="https://gis.stackexchange.com/questions/142052/alter-the-m-values-of-an-existing-route" target="_blank" rel="noopener"&gt;SO&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyr = r"C:\Users\...\Default.gdb\TEST_ROUTE"  
fields = ['SHAPE@']

with arcpy.da.UpdateCursor(lyr, fields) as cursor:
    for row in cursor:
        partslist = []
        partlist = []
        array = None
        feat = row[0]
        partnum = 0  

        # Count the number of points in the current multipart feature  
        partcount = feat.partCount  
        pntcount = 0  

        # Enter while loop for each part in the feature (if a singlepart feature  
        # this will occur only once)  
        #  
        while partnum &amp;lt; partcount:  
            part = feat.getPart(partnum)  
            pnt = part.next()  

            # Enter while loop for each vertex  
            #  
            while pnt:  
                pntcount += 1  
                if not numpy.isnan(pnt.M):
                    partlist.append(arcpy.Point(pnt.X, pnt.Y, pnt.Z, pnt.M / 1000))
                pnt = part.next()  

                # If pnt is null, either the part is finished or there is an   
                # interior ring  
                #  
                if not pnt:   
                    pnt = part.next()  
            partslist.append(arcpy.Array(partlist))
            array = arcpy.Array(partslist)
            partlist = []
            partnum += 1
        polylinefeat = arcpy.Polyline(array)
        row[0] = polylinefeat
        cursor.updateRow(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Apr 2023 14:44:07 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2023-04-26T14:44:07Z</dc:date>
    <item>
      <title>ArcGIS Pro M value tools: Is "Set Direction As M" in arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-m-value-tools-is-quot-set-direction-as/m-p/1281040#M67468</link>
      <description>&lt;P&gt;ArcGIS Pro has tools for working with M values. Are these functionalities available in arcpy?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="m-value-tools-arcgis-pro.png" style="width: 326px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68654i88B13EB7E06221EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="m-value-tools-arcgis-pro.png" alt="m-value-tools-arcgis-pro.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 21:10:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-m-value-tools-is-quot-set-direction-as/m-p/1281040#M67468</guid>
      <dc:creator>DanielWebb</dc:creator>
      <dc:date>2023-04-20T21:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro M value tools: Is "Set Direction As M" in arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-m-value-tools-is-quot-set-direction-as/m-p/1282833#M67518</link>
      <description>&lt;P&gt;Think you'll have to do it manually with a cursor and extracting the m from the point.&amp;nbsp; Stealing a post from &lt;A href="https://gis.stackexchange.com/questions/142052/alter-the-m-values-of-an-existing-route" target="_blank" rel="noopener"&gt;SO&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyr = r"C:\Users\...\Default.gdb\TEST_ROUTE"  
fields = ['SHAPE@']

with arcpy.da.UpdateCursor(lyr, fields) as cursor:
    for row in cursor:
        partslist = []
        partlist = []
        array = None
        feat = row[0]
        partnum = 0  

        # Count the number of points in the current multipart feature  
        partcount = feat.partCount  
        pntcount = 0  

        # Enter while loop for each part in the feature (if a singlepart feature  
        # this will occur only once)  
        #  
        while partnum &amp;lt; partcount:  
            part = feat.getPart(partnum)  
            pnt = part.next()  

            # Enter while loop for each vertex  
            #  
            while pnt:  
                pntcount += 1  
                if not numpy.isnan(pnt.M):
                    partlist.append(arcpy.Point(pnt.X, pnt.Y, pnt.Z, pnt.M / 1000))
                pnt = part.next()  

                # If pnt is null, either the part is finished or there is an   
                # interior ring  
                #  
                if not pnt:   
                    pnt = part.next()  
            partslist.append(arcpy.Array(partlist))
            array = arcpy.Array(partslist)
            partlist = []
            partnum += 1
        polylinefeat = arcpy.Polyline(array)
        row[0] = polylinefeat
        cursor.updateRow(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 14:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-m-value-tools-is-quot-set-direction-as/m-p/1282833#M67518</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-04-26T14:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro M value tools: Is "Set Direction As M" in arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-m-value-tools-is-quot-set-direction-as/m-p/1287902#M67615</link>
      <description>&lt;P&gt;This seems to do what I want. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 18:56:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-m-value-tools-is-quot-set-direction-as/m-p/1287902#M67615</guid>
      <dc:creator>DanielWebb</dc:creator>
      <dc:date>2023-05-10T18:56:37Z</dc:date>
    </item>
  </channel>
</rss>

