<?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: Multiple number extraction from field in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/multiple-number-extraction-from-field/m-p/1215422#M60153</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this do what you want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open the Python window:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1663915551766.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52003iA24C45FDE47A4ECC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1663915551766.png" alt="JohannesLindner_0-1663915551766.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy and paste this script, hit enter twice:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# create the output feature class
route_stops = arcpy.management.CreateFeatureclass("memory", "RouteStops", "POINT")
arcpy.management.AddField(route_stops, "stop_id","LONG")
arcpy.management.AddField(route_stops, "route","TEXT")

# start inserting into the new fc
with arcpy.da.InsertCursor(route_stops, ["SHAPE@", "stop_id", "route"]) as i_cursor:
    # loop through the stops
    with arcpy.da.SearchCursor("bus_stops", ["SHAPE@", "stop_id", "stop_desc"]) as s_cursor:
        for shp, id, desc in s_cursor:
            # extract the routes from the field stop_desc:
            # delete spaces, get everthing after "routes:" and split that at "/"
            routes = desc.replace(" ", "").split("routes:")[-1].split("/")
            # for each route, write a point into the new fc
            for route in routes:
                i_cursor.insertRow([shp, id, route])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will create a feature class in RAM (so export it if you want to keep it). This feature class will have two fields: The stop_id and the route. It will have a point for each route at each stop. So in your example, it will have 3 overlapping points for stop_id 12143, one for each of the routes 1, 5, and 10.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Sep 2022 06:50:41 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-09-23T06:50:41Z</dc:date>
    <item>
      <title>Multiple number extraction from field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/multiple-number-extraction-from-field/m-p/1215396#M60151</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the latest version of ArcGIS Pro.&amp;nbsp; I have a dataset of individual bus stops which I am trying to map as the bus routes.&amp;nbsp; The routes are identified within a string of additional information.&amp;nbsp; Some strings contain multiple routes within one row.&amp;nbsp; I don' t know Python.&amp;nbsp; How can I extract the numbers from the "stop_desc" field in a way that I can then dissolve the resulting field numbers into a single route.&amp;nbsp; In the image below, row 1 indicates that routes 1, 5 and 10 are represented at that stop.&amp;nbsp; I have created a new field titled "route" for the numbers to be extracted.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2022-09-22 210504.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/51997iC378CA8913EAF378/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-09-22 210504.jpg" alt="Screenshot 2022-09-22 210504.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 04:07:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/multiple-number-extraction-from-field/m-p/1215396#M60151</guid>
      <dc:creator>dgmoore099</dc:creator>
      <dc:date>2022-09-23T04:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple number extraction from field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/multiple-number-extraction-from-field/m-p/1215422#M60153</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this do what you want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open the Python window:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1663915551766.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52003iA24C45FDE47A4ECC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1663915551766.png" alt="JohannesLindner_0-1663915551766.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy and paste this script, hit enter twice:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# create the output feature class
route_stops = arcpy.management.CreateFeatureclass("memory", "RouteStops", "POINT")
arcpy.management.AddField(route_stops, "stop_id","LONG")
arcpy.management.AddField(route_stops, "route","TEXT")

# start inserting into the new fc
with arcpy.da.InsertCursor(route_stops, ["SHAPE@", "stop_id", "route"]) as i_cursor:
    # loop through the stops
    with arcpy.da.SearchCursor("bus_stops", ["SHAPE@", "stop_id", "stop_desc"]) as s_cursor:
        for shp, id, desc in s_cursor:
            # extract the routes from the field stop_desc:
            # delete spaces, get everthing after "routes:" and split that at "/"
            routes = desc.replace(" ", "").split("routes:")[-1].split("/")
            # for each route, write a point into the new fc
            for route in routes:
                i_cursor.insertRow([shp, id, route])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will create a feature class in RAM (so export it if you want to keep it). This feature class will have two fields: The stop_id and the route. It will have a point for each route at each stop. So in your example, it will have 3 overlapping points for stop_id 12143, one for each of the routes 1, 5, and 10.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 06:50:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/multiple-number-extraction-from-field/m-p/1215422#M60153</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-09-23T06:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple number extraction from field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/multiple-number-extraction-from-field/m-p/1215583#M60172</link>
      <description>&lt;P&gt;That did it.&amp;nbsp; Thanks Johannes!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 16:20:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/multiple-number-extraction-from-field/m-p/1215583#M60172</guid>
      <dc:creator>dgmoore099</dc:creator>
      <dc:date>2022-09-23T16:20:14Z</dc:date>
    </item>
  </channel>
</rss>

