<?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 EXTRACT DATA WITHIN LAYERS in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/extract-data-within-layers/m-p/1131435#M43765</link>
    <description>&lt;P&gt;I need help on how to extract data from my files.&amp;nbsp; I have layers where I have a "boundary" drawn around 4 houses that I have obtained addresses for; then within that boundary, I have items added that will serve those 4 houses.&amp;nbsp; I do this throughout the neighborhood.&amp;nbsp; If it helps, this is for telecom to determine where each home will be served.&amp;nbsp; I need to extract the data to give me a list of the addresses contained within the boundary as well as the terminal I placed to serve them.&amp;nbsp; Is there a way to extract all the data within several boundaries on a map?&amp;nbsp; I am attaching a picture that shows the green boundaries, with the triangle(terminal) and house symbols inside the green boundary.&amp;nbsp; Notice there are several green boundaries that only cover 4 homes.&amp;nbsp; Can I get all the info I am asking for from extracting the data?&amp;nbsp; If so, how?&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jan 2022 22:16:02 GMT</pubDate>
    <dc:creator>RobinsonMyers</dc:creator>
    <dc:date>2022-01-06T22:16:02Z</dc:date>
    <item>
      <title>EXTRACT DATA WITHIN LAYERS</title>
      <link>https://community.esri.com/t5/data-management-questions/extract-data-within-layers/m-p/1131435#M43765</link>
      <description>&lt;P&gt;I need help on how to extract data from my files.&amp;nbsp; I have layers where I have a "boundary" drawn around 4 houses that I have obtained addresses for; then within that boundary, I have items added that will serve those 4 houses.&amp;nbsp; I do this throughout the neighborhood.&amp;nbsp; If it helps, this is for telecom to determine where each home will be served.&amp;nbsp; I need to extract the data to give me a list of the addresses contained within the boundary as well as the terminal I placed to serve them.&amp;nbsp; Is there a way to extract all the data within several boundaries on a map?&amp;nbsp; I am attaching a picture that shows the green boundaries, with the triangle(terminal) and house symbols inside the green boundary.&amp;nbsp; Notice there are several green boundaries that only cover 4 homes.&amp;nbsp; Can I get all the info I am asking for from extracting the data?&amp;nbsp; If so, how?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2022 22:16:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/extract-data-within-layers/m-p/1131435#M43765</guid>
      <dc:creator>RobinsonMyers</dc:creator>
      <dc:date>2022-01-06T22:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: EXTRACT DATA WITHIN LAYERS</title>
      <link>https://community.esri.com/t5/data-management-questions/extract-data-within-layers/m-p/1131555#M43767</link>
      <description>&lt;P&gt;It is absolutely possible. What you need to do:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;intersect boundaries and houses: this returns a point layer with addresses and boundary names&lt;/LI&gt;&lt;LI&gt;intersect boundaries and stations: this returns a point layer with station names and boundary names&lt;/LI&gt;&lt;LI&gt;use a way to connect the two layers using the common attribute boundary name&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;A basic implementation of these steps in Python (assuming you work with ArcMap or ArcGIS Pro: open the Python window, paste and edit the code below, execute):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# names of the 3 layers
boundary_layer = "Boundaries"
station_layer = "Stations"
house_layer = "Houses"
# names of the fields you want to extract
boundary_field = "BoundaryID"
station_field = "StationID"
house_field = "Address"

# intersect boundaries and stations
station_intersect = arcpy.analysis.Intersect([boundary_layer, station_layer], "memory/station_intersect")
# intersect boundaries and houses
house_intersect = arcpy.analysis.Intersect([boundary_layer, house_layer], "memory/house_intersect")
# read boundary data: [boundary_field]
boundaries = [row[0] for row in arcpy.da.SearchCursor(boundary_layer, [boundary_field])]
# read station data: [ [boundary_field, station_field] ]
stations = [row for row in arcpy.da.SearchCursor(station_intersect, [boundary_field, station_field])]
# read house data: [ [boundary_field, house_field] ]
houses = [row for row in arcpy.da.SearchCursor(house_intersect, [boundary_field, house_field])]

# connect station data and house data: 
# {boundary_field: {"stations": [station_field], "houses": [house_field]}}
boundary_dict = {b: {"stations": [s[1] for s in stations if s[1] == b], "houses": [h[1] for h in houses if h[0] == b]} for b in boundaries}

import pprint
pprint.pprint(boundary_dict)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to extract the data for only a few boundries, select those boundaries before you run the code.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 12:17:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/extract-data-within-layers/m-p/1131555#M43767</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-01-07T12:17:19Z</dc:date>
    </item>
  </channel>
</rss>

