Summarizing Point Attributes Within A Polygon

3181
8
06-02-2018 07:25 AM
HankArnold
New Contributor III

I'm using ArcGIS Desktop 10.6, have a layer with 35k points representing the location of each individual bird in a drone based wildlife study, and several polygons representing areas within the overall map.

What I'm looking for is a list of all the birds that fall within a particular polygon, with a total for each species.

With the entire database of all birds, I can summarize and get the totals, so I'm thinkin that's the direction I need to go, but I can't get a subset database of points within a polygon.

If I do a join from the polygon to the species database, I get a single line representing the total for all birds within the polygon that sounds about right, but only a single line. This also gives me the idea that both the polygon and the database are properly defined and positioned.

When I do a join from the species database to the polygon, I get every bird in the original database, 35k.

I've looked through the other "Polygon/Point" discussions and searched the web, and my fear is that my question is so simple that I can't find it somewhere else

Any suggestions appreciated

Tags (1)
0 Kudos
8 Replies
MervynLotter
Regular Contributor

You are almost there. Do a join from species to polygon so that you have 35k records, then just open attribute table and the the Summarize tool on the unique polygon number/name. In the option to choose one or more summary stats to be included, make sure you select your unique bird name. It will list the relevant species and provide a count.

Mike Miller also created a similar online tool to do this, with added diversity indices. Do see Diversity Calculator - Geospatial Brainstorming 

0 Kudos
MervynLotter
Regular Contributor

Sorry, one small change in my suggestion, you will need to run the Summary Statistics tool. 

Statistics Field is species name with stats type as count. The case field will be both your species and polygon name/number fields.

HankArnold
New Contributor III

Mervyn,

Thanks very much for the response.

When I do the join from the 35k layer to one of the area polygons, and get the new 35k table, I do get a bunch of new fields, but none that I can see that has any information of individual points being in the polygon

I'm attaching a screen shot of the table.

Except for the species, lat, lon, etc that are defined in the original dataset, none of the new fields shows any difference, all the way down.

If I could get a 35k table with some way to delineate the points in the polygon, there are several options to get the totals, including exporting the data and working with something I'm more familiar with.

How can I tell in the newly create 35k table, which records were within the boundary of the join?

Thanks in advanceScreenshot of the table created by a join from a master dataset to a polygon

0 Kudos
MervynLotter
Regular Contributor

You will have to open up your polygon layer to check whether it has a

unique identifier, whether it be a grid name, farm or reserve name, etc.

The way I understand it, you want a species list with abundances (counts)

for each polygon (or one polygon in your case), so each polygon requires a

unique name. From the table you provided, I can not easily see if you in

fact do have a unique name or number.

If not, add a unique name to your polygon then summarize as in my second

post.

0 Kudos
HankArnold
New Contributor III

Mervyn,

First, thanks again for taking the time and effort to help me. If you can think of a resource I can study without taking up your time, please let me know.

Being new to ArcGIS, I'm sure I have imported something wrong, and your suggestion about the unique identifier make perfect sense, as I had several KMLs imported from Google Earth that all came in with the name "Polygon".

I used the "properties" tab to change the "layer name" for the polygon I was working with to something unique and re-ran the join, but still got 35k entries with no visible field changes that would show any particular record was in our out of the polygon.

Then I deleted all the other polygons, and still got 35k records with no polygon designation.

Finally, I started a new map environment, just loaded the species list, exported it to a layer, loaded the KML as a layer, and re-ran the join again.

Still 35k records with no designation of being within the polygon.

Is there supposed to be some field in the join result table that says whether or not the record is in the polygon? If not, how is doing statistics on the table going the help?

Its not at all important for now, but I also can't get the Summary Statistics to do anything with the resulting 35k table because it requires a "Statistics Field", but no matter what field I select, I get a "ERROR 000800 - The value is not a member SUM | MEAN | ...".

My thinking is that if I can get something in the 35k join output that tells me which records are in the polygon, I can learn how to use that tool as a later step.

Again,

Thanks for taking to the time to help/teach me

Hank

Texas

0 Kudos
MervynLotter
Regular Contributor

Hi Hank

So you have to have a unique polygon identifier in your imported KML file before running the spatial join. You cant just change the properties, you either have to use an existing field or create a new one.  

I just tested this and after importing a KML, the name of your original kml input file will appear in the field FolderPath. Just right-click on this field heading and sort descending. All areas outside of your polygon will have no values and you should see you KML file name at the top of your attribute table (if you kept with the defaults).

So lets use this FolderPath field now in the below instructions but you could quite easily also add a new field using the Add Field ... functionality in your open table, but make sure you do this to the imported polygon file after importing but before running the spatial join. Then use a Field Calculator to give it a useful name. 

So going with the species field name and FolderPath field names, open Summary Statistics and add these as Case field. Then under Statistic Field, add Species (in my example I use Taxon).  You will get the below error until you select the statistics type on the right. Just click to the right of your species field (where arrow is pointing to) and you should then see more options (rather hidden and not that user friendly unless you know about it).

Select count and click OK. The output is a table which will list all the species (and a count of their observations) within your polygons. If you have several unique polygon names then the species list and count will be for each unique polygon.

Let me know if there are any problems.  

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Do a Select by Location

http://pro.arcgis.com/en/pro-app/tool-reference/data-management/select-layer-by-location.htm

The polygon is your selector.  It will select all the points in the polygon.

Then right-click on the layer, Data, export features.... you will now have a separate point layer which represents the points in those polygons.

You are done.

Repeat if you only have a few, because I know at some stage you are going to want to split the data up into its separate components, so do it up front and keep the original data intact, unjoined and unspoiled

HankArnold
New Contributor III

Dan,

This worked perfectly.

I want to learn how to get Mervyn's suggestion to work, because I need to learn how to properly import and work with different types of data, but your method is independent of identifiers, Object IDs, etc.

 

Thanks very much

0 Kudos